Skip to content

Position 3D Animation

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

WoWoPositionAnimation

WoWoPosition3DAnimation changes x, y and z values of a view by method setX, setY and setZ. But please notice that setZ is available from Lollipop. So WoWoPosition3DAnimation is unable to change z value of a view below Lollipop. WoWoPosition3DAnimation is similar to WoWoPositionAnimation, so there is no example in the demo.

viewAnimation.add(WoWoPosition3DAnimation.builder().page(0)
        .fromX(view.getX()).toX(0)
        .fromY(view.getY()).toY(0)
        .fromZ(view.getZ()).toZ(0)
        .ease(ease).build());

As mentioned in WoWoPositionAnimation, we should add WoWoPosition3DAnimation in onWindowFocusChanged method. Otherwise the value of view.getX() maybe zero.

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

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

    // Add animations
}

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

Methods List of WoWoPosition3DAnimation.builder()

Clone this wiki locally