Skip to content

Translation Animation

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


WoWoTranslationAnimation changes the translation x, y values of a view with methods setTranslationX and setTranslationY. Different with WoWoPositionAnimation, the x, y values here is relative to the original ones.

        .fromX(view.getTranslationX()).toX(-screenW / 2 + radius)
        .fromY(view.getTranslationY()).toY(-screenH / 2 + radius)

Similar to WoWoPositionAnimation, the animation-adding job is better to do after when the views-layout happened. So in the WoWoTranslationAnimationActivity as a demo, I put the code in onWindowFocusChanged methods:

public void onWindowFocusChanged(boolean hasFocus) {

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

    // Add animations

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

Methods List of WoWoTranslationAnimation.builder()

You can’t perform that action at this time.