Skip to content

Scale Animation

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

In Basic Usage, we talked about how to add animations for a view and take WoWoScaleAnimation as an example. WoWoScaleAnimation changes the scale up or down values of a view's width or height by setScaleX and setScaleY methods.

@Override
protected void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);

    ...

    ViewAnimation viewAnimation = new ViewAnimation(findViewById(R.id.test));
    viewAnimation.add(WoWoScaleAnimation.builder().page(0).fromXY(1).toXY(0.5).build());
    viewAnimation.add(WoWoScaleAnimation.builder().page(1).fromXY(0.5).toXY(4).build());
    viewAnimation.add(WoWoScaleAnimation.builder().page(2).start(0).end(0.5).fromX(4).toX(1).keepY(4).build());
    viewAnimation.add(WoWoScaleAnimation.builder().page(2).start(0.5).end(1).keepX(1).fromY(4).toY(1).build());
    viewAnimation.add(WoWoScaleAnimation.builder().page(3).start(0).end(0.5).keepX(1).fromY(1).toY(3).build());
    viewAnimation.add(WoWoScaleAnimation.builder().page(3).start(0.5).end(1).fromX(1).toX(3).keepY(3).build());

    wowo.addAnimation(viewAnimation);
    wowo.ready();
}

WoWoScaleAnimation extends XYPageAnimation and PageAnimation. Check more implementation details in its superclasses.

Methods List of WoWoScaleAnimation.builder()