-
Notifications
You must be signed in to change notification settings - Fork 451
Translation 3D Animation
Weiping Huang edited this page Apr 5, 2017
·
4 revisions
WoWoTranslation3DAnimation provides an animation to change the relative x, y and z values of a view. Notice that setTranslationZ
is only available from Lollipop, which means changing z value does not work below Lollipop. WoWoTranslation3DAnimation is similar to WoWoTranslationAnimation.
viewAnimation.add(WoWoTranslation3DAnimation.builder().page(0)
.fromX(view.getTranslationX()).toX(-screenW / 2 + radius)
.fromY(view.getTranslationY()).toY(-screenH / 2 + radius)
.fromZ(view.getTranslationZ()).toZ(1)
.ease(ease).build());
To get the correct values of translation x, y and z, you should add WoWoTranslation3DAnimation after the views-layout jobs happened in activity.
@Override
public void onWindowFocusChanged(boolean hasFocus) {
super.onWindowFocusChanged(hasFocus);
addAnimations();
}
private void addAnimations() {
// Prevent duplicate adding
if (animationAdded) return;
animationAdded = true;
// Add animations
}
WoWoTranslation3DAnimation extends XYZPageAnimation and PageAnimation. Check more implementation details in its superclasses.
Basic Animations
- Position Animation
- Position 3D Animation
- Translation Animation
- Translation 3D Animation
- Scale Animation
- Alpha Animation
- Rotation Animation
- Elevation Animation
TextView Animations
Color Animations
- Background Color Animation
- Shape Color Animation
- State-List Color Animation
- Layer-List Color Animation
Interface Expansibility