Skip to content

Rotation Animation

Weiping Huang edited this page Apr 5, 2017 · 3 revisions

WoWoRotationAnimation provides an animation to change the x, y and z degree value of a view by setRotationX, setRotationY and setRotation methods.

        _ _ _ _ _ _ _
      /|    x
     / |
    /  |y
   /   |
  /z   |
 /     |

The rotation animation in the above gif is implemented by the following code:

@Override
protected void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);
    ViewAnimation viewAnimation = new ViewAnimation(findViewById(R.id.test));
    viewAnimation.add(WoWoRotationAnimation.builder().page(0)
            .fromX(0).toX(180).keepY(0).keepZ(0).build());
    viewAnimation.add(WoWoRotationAnimation.builder().page(1)
            .keepX(180).fromY(0).toY(180).keepZ(0).build());
    viewAnimation.add(WoWoRotationAnimation.builder().page(2)
            .keepX(180).keepY(180).fromZ(0).toZ(180).build());
    viewAnimation.add(WoWoRotationAnimation.builder().page(3).start(0).end(0.5)
            .keepX(180).keepY(180).fromZ(180).toZ(90).build());
    viewAnimation.add(WoWoRotationAnimation.builder().page(3).start(0.5).end(1)
            .fromX(180).toX(90).keepY(180).keepZ(90).build());
    wowo.addAnimation(viewAnimation);
    wowo.setEase(ease);
    wowo.setUseSameEaseBack(useSameEaseTypeBack);
    wowo.ready();
}

WoWoRotationAnimation extends XYZPageAnimation and PageAnimation. Check more implementation details in its superclasses.

Methods List of WoWoRotationAnimation.builder()

Clone this wiki locally