-
Notifications
You must be signed in to change notification settings - Fork 451
Position Animation
Weiping Huang edited this page Apr 5, 2017
·
9 revisions
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.
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