美文网首页
Android动画详解(二)插值器

Android动画详解(二)插值器

作者: Aaron大宝剑 | 来源:发表于2018-11-16 16:34 被阅读0次

在上一篇Android动画详解(一)补间动画中我们提到过一个叫插值器的东西,看名字一头雾水完全不知道是什么神奇玩意。其实用人话翻译过来就是速度模型或者速度曲线的意思。为动画设置插值器就是设定动画的速度模型,就是设置它是怎么动的,先加速再加速呀、一直减速呀、匀速的运动啊。插值器不只是补间动画需要设置啊,后面要讲的属性动画一样有插值器。具体效果一看动图便知。

1、AccelerateDecelerateInterpolator

先加速运动再减速知道终点处,这也是默认的Interpolator,如果不setInterpolator(interpolator),动画以该方式运动。

accelaratedecelarate.gif

2、AccelerateInterpolator

一直加速前进,在终点处骤停。

accelerate.gif

3、AnticipateInterpolator

先往回拉一小段距离,在先前运动。

anticipate.gif

4、AnticipaOvershootInterpolator

先往回拉一小段距离,在先前运动,最后超出终点一小段距离再回到终点。

anticipateovershoot.gif

5、BounceInterpolator

向前运动,在终点处回弹几下。

bounce.gif

6、CycleInterpolator

CycleInterpolator(float cycles),参数表示来回运动次数。在起点和终点之间来回运动,重复几次由它的cycles参数决定。

cycles.gif

7、DecelerateInterpolator

初速度最大,然后一直加速运动到终点。

decelerate.gif

8、LinearInterpolator

匀速运动。

linear.gif

9、OvershootInterpator

它跟AnticipaOvershootInterpolator的区别是,刚开始的时候不需要往后拉一小段距离;相同之处是运动地超过终点一部分然后回到终点。

overshoot.gif

相关文章

网友评论

      本文标题:Android动画详解(二)插值器

      本文链接:https://www.haomeiwen.com/subject/agimfqtx.html