Skip to content

Position Animation

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

WoWoPositionAnimation

WoWoPositionAnimation change x and y value of a view by method setX and setY.

viewAnimation.add(WoWoPositionAnimation.builder().page(0)
        .fromX(view.getX()).toX(0)
        .fromY(view.getY()).toY(0)
        .ease(ease).build());

Notice that we cannot get the position of a view in onCreate method in an activity. So, as the code in WoWoPositionAnimationActivity, we do the animation-adding job in onWindowFocusChanged method:

@Override
public void onWindowFocusChanged(boolean hasFocus) {
    super.onWindowFocusChanged(hasFocus);
    addAnimations();
}

private void addAnimations() {
    // Prevent duplicate adding
    if (animationAdded) return;
    animationAdded = true;

    // Add animations
}

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

Methods List of WoWoPositionAnimation.builder()

Clone this wiki locally