你创建了一个漂亮的UI,但是它很单调
运行这个player可以在进入Activity或者Fragment的时候为view创建漂亮的过渡效果。
将它放到Activity的onCreate()或者Fragment的onViewCreated()中。Player.init().
animate(headerAction).
then().
animate(fabAction).
then().
animate(bottomAction).
play();
效果:
其中的三个action分别是这样定义的:final PropertyAction fabAction = PropertyAction.newPropertyAction(activityMainPinkFab).
scaleX(0).
scaleY(0).
duration(750).
interpolator(new AccelerateDecelerateInterpolator()).
build();
final PropertyAction headerAction = PropertyAction.newPropertyAction(activityMainheaderLayout).
interpolator(new DecelerateInterpolator()).
translationY(-200).
duration(550).
alpha(0.4f).
build();
final PropertyAction bottomAction = PropertyAction.newPropertyAction(activityMainMobileNumberLayout).
translationY(500).
duration(550).
alpha(0f).
build();
自定义
要自定义action,只需继承BaseAction并实现下面的两个方法。void init(final View view);
void animate(final View view);
下载dependencies {
compile 'com.eftimoff:androidplayer:[email protected]'
}
随心所欲的制作属于你的动画效果