-
Notifications
You must be signed in to change notification settings - Fork 451
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.
viewAnimation.add(WoWoTranslationAnimation.builder().page(0)
.fromX(view.getTranslationX()).toX(-screenW / 2 + radius)
.fromY(view.getTranslationY()).toY(-screenH / 2 + radius)
.ease(ease).build());
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:
@Override
public void onWindowFocusChanged(boolean hasFocus) {
super.onWindowFocusChanged(hasFocus);
addAnimations();
}
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.
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