Reputation: 47
I'm currently working on an Android game
I want to create an image flip effect using animation. How would I do it?
Upvotes: 0
Views: 7587
Reputation: 424
I managed to achieve this using setScaleX (for flip/reflection around the Y axis). Use setScaleY for flip/reflection around the X axis.
final ValueAnimator rotation = ValueAnimator.ofFloat(0, 360);
Then in your onAnimationUpdate
function, set scale on X or Y using the cosine function on your range of angles.
view.setScaleX((float)Math.cos(Math.toRadians((Float)valueAnimator.getAnimatedValue())));
Hope this helps
Upvotes: 0
Reputation: 7295
try this: Android Animation - Flip
or more complex: http://www.inter-fuser.com/2009/08/android-animations-3d-flip.html
Upvotes: 0