Posts

Showing posts with the label Animation

Card Flip Animation Between Activities

Image
Answer : From what I've got you can't do exactly that same card flip between activities. BUT, as you might already know you need overridePendingTransition() in order to animate transition between activities (doc here). Now all you need is an animation resource to do the trick. I used these: fade_in.xml <?xml version="1.0" encoding="utf-8"?><set xmlns:android="http://schemas.android.com/apk/res/android" > <scale android:duration="200" android:fromXScale="0.0" android:fromYScale="1.0" android:interpolator="@android:anim/accelerate_decelerate_interpolator" android:pivotX="50%" android:pivotY="50%" android:startOffset="200" android:toXScale="1.0" android:toYScale="1.0" /> <alpha android:duration="1" android:fromAlpha="0.0" android:startOffset="200" andr...

Adding Borders To GridPane JavaFX

Answer : Don't use setGridLinesVisible(true) : the documentation explicitly states this is for debug only. Instead, place a pane in all the grid cells (even the empty ones), and style the pane so you see the borders. (This gives you the opportunity to control the borders very carefully, so you can avoid double borders, etc.) Then add the content to each pane. You can also register the mouse listeners with the pane, which means you don't have to do the ugly math to figure out which cell was clicked. The recommended way to apply a border to any region is to use CSS and a "nested background" approach. In this approach, you draw two (or more) background fills on the region, with different insets, giving the appearance of a border. So for example: -fx-background-fill: black, white ; -fx-background-insets: 0, 1 ; will first draw a black background with no insets, and then over that will draw a white background with insets of 1 pixel on all sides, giving the appea...

Animate CSS Background-position With Smooth Results (sub-pixel Animation)

Answer : Checkout this example: #content { height: 300px; text-align: center; font-size: 26px; color: #000; position:relative; } .bg{ position: absolute; left: 0; right: 0; top: 0; bottom: 0; z-index: -1; background: url(http://www.gstatic.com/webp/gallery/1.jpg) 0% 0% repeat; animation-name: MOVE-BG; animation-duration: 100s; animation-timing-function: linear; animation-iteration-count: infinite; } @keyframes MOVE-BG { from { transform: translateX(0); } to { transform: translateX(-187%); } } <div id="content">Foreground content <div class="bg"></div> </div> http://jsfiddle.net/5pVr4/4/ Animating background-position will cause some performance issues. Browsers will animate transform properties much cheaply, including translate. Here is an example using translate for an infinite slide animation (without prefixes): http://jsfiddle.net/brunomuller/5pVr4/504/ @-webkit-ke...

Animate Height On V-if In Vuejs Using Transition

Answer : It doesn't look like you've posted all the code, but hopefully I understand the goal. Try moving the transition to the max-height property: .fadeHeight-enter-active, .fadeHeight-leave-active { transition: all 0.2s; max-height: 230px; } .fadeHeight-enter, .fadeHeight-leave-to { opacity: 0; max-height: 0px; } as long as you set a max height to be larger than the tallest element , it should accomplish what you need. Note that you may also want to use overflow:hidden as well. If you have dramatic variation of the actual height of the elements, this solution may not be the best, as it will make the animation duration/delay appear very different. https://jsfiddle.net/7ap15qq0/4/

Animating ImageButton In Android?

Answer : Try this code snippet. rotate.xml <?xml version="1.0" encoding="utf-8"?> <set xmlns:android="http://schemas.android.com/apk/res/android"> <rotate android:fromDegrees="0" android:toDegrees="360" android:pivotX="50%" android:pivotY="50%" android:repeatCount="0" android:duration="1000" /> </set> in java file ImageButton imgbt = (ImageButton)findViewById(R.id.your_id); Animation ranim = (Animation)AnimationUtils.loadAnimation(context, R.anim.rotate); imgbt.setAnimation(ranim); rotate.xml <?xml version="1.0" encoding="utf-8"?> <rotate xmlns:android="http://schemas.android.com/apk/res/android" android:duration="1000" android:fromDegrees="0" android:interpolator="@android:anim/linear_interpolator" android:pivotX="50%" android:pivotY=...

Can You Control GIF Animation With Javascript?

Answer : You can use the libgif library. It allows you to start/stop the gif and control which frame the gif is on. <script type="text/javascript" src="./libgif.js"></script> <img src="./example1_preview.gif" rel:animated_src="./example1.gif" width="360" height="360" rel:auto_play="1" rel:rubbable="1" /> <script type="text/javascript"> $$('img').each(function (img_tag) { if (/.*\.gif/.test(img_tag.src)) { var rub = new SuperGif({ gif: img_tag } ); rub.load(function(){ console.log('oh hey, now the gif is loaded'); }); } }); </script> (most of the code is taken directly from their example) I use x-gif it's pretty cool and easy to setup. From Github: <x-gif src="probably_cats.gif"></x-gif> Where you can add the following as attributes...