0

I'm currently working on an Android game

I want to create an image flip effect using animation. How would I do it?

Simon Sarris
  • 62,212
  • 13
  • 141
  • 171
Nguyen Nguyen
  • 47
  • 2
  • 9

3 Answers3

2

There is a good example of such here

Rawkode
  • 21,990
  • 5
  • 38
  • 45
  • Your answer is helpful, but you can make it better by including a summary or relevant portions of the pages you're linking to. This will also help your answer remain great even if the links you included break in the future. – Janusz May 15 '12 at 10:52
0

try this: Android Animation - Flip

or more complex: http://www.inter-fuser.com/2009/08/android-animations-3d-flip.html

Community
  • 1
  • 1
goodm
  • 7,275
  • 6
  • 31
  • 55
  • Your answer is helpful, but you can make it better by including a summary or relevant portions of the pages you're linking to. This will also help your answer remain great even if the links you included break in the future. – Janusz May 15 '12 at 10:53
  • Maybe you are right, but there is no reason to down vote my answer. You can comment or put your own answer. He asked a question, which is basic and quick google search. If he expect more precise answer, probably he should precise his question or comment my answer. – goodm May 15 '12 at 10:57
0

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

Nelson
  • 414
  • 3
  • 17