一套流畅的 Android 动画库
一个流畅的Android动画库!
# 使用方法从一个方法中动画化多个视图
ViewAnimator
.animate(image)
.translationY(-1000, 0)
.alpha(0,1)
.andAnimate(text)
.dp().translationX(-20, 0)
.decelerate()
.duration(2000)
.thenAnimate(image)
.scale(1f, 0.5f, 1f)
.accelerate()
.duration(1000)
.start();
不使用ViewAnimator
…在多个视图上添加相同的动画
ViewAnimator
.animate(image,text)
.scale(0,1)
.start();添加监听器
ViewAnimator
.animate(image)
.scale(0,1)
.onStart(() -> {})
.onStop(() -> {})
.start();
使用DP值
ViewAnimator
.animate(image)
.dp().translationY(-200, 0)
.start();动画化高度/宽度
ViewAnimator
.animate(view)
.waitForHeight() //wait until a ViewTreeObserver notification
.dp().width(100,200)
.dp().height(50,100)
.start();颜色动画
ViewAnimator
.animate(view)
.textColor(Color.BLACK,Color.GREEN)
.backgroundColor(Color.WHITE,Color.BLACK)
.start();旋转动画
ViewAnimator
.animate(view)
.rotation(360)
.start();自定义动画
ViewAnimator
.animate(text)
.custom(new AnimationListener.Update<TextView>() {
@Override public void update(TextView view, float value) {
view.setText(String.format("%.02f",value));
}
}, 0, 1)
.start();取消动画
ViewAnimator viewAnimator = ViewAnimator
.animate(view)
.rotation(360)
.start();
viewAnimator.cancel();增强动画(感谢 AndroidViewAnimations 和 NiftyDialogEffects )
.shake().interpolator(new LinearInterpolator());
.bounceIn().interpolator(new BounceInterpolator());
.flash(
<a href="https://goo.gl/WXW8Dc">暂无开放 Issues,或尚未同步最近议题。