Android动画----Interpolator(插入器)

来源:互联网 发布:http www.123js.cn 编辑:程序博客网 时间:2024/05/14 07:50

引言

   Android的几种基础动画前面的几篇博客已经介绍的差不多了,在前几篇博客一直预留了一个问题就是Interpolator的说明,本篇博客就着重介绍一下Interpolator的含义

Interpolator的含义

   Interpolator字典意思是插入器,在动画当中充当的角色就是动作,类似于我们做PPT时,为动画添加动作,Android系统也为动画提供了很多动作,Interpolator本身是个接口,Android提供了很多实现类,下面我们就看看这些实现类。

Interpolator的实现类

AccelerateDecelerateInterpolator

  动作效果:An interpolator where the rate of change starts and ends slowly but accelerates through the middle.
  译:动画的变化速率开始和结束时慢,中间时快。

AccelerateInterpolator

  动作效果:An interpolator where the rate of change starts out slowly and and then accelerates.
  译:开始时比较慢,并且慢慢加速。

AnticipateInterpolator

  动作效果:An interpolator where the change starts backward then flings forward.
  译:开始时向后甩然后向前滑到

AnticipateOvershootInterpolator

  动作效果:An interpolator where the change starts backward then flings forward and overshoots the target value and finally goes back to the final value.
  译:开始时向后甩然后向前超过终止时的值最后回退到终止的值。

BounceInterpolator

  动作效果:An interpolator where the change bounces at the end.
  译:在结束时反弹

CycleInterpolator

  动作效果:Repeats the animation for a specified number of cycles. The rate of change follows a sinusoidal pattern.
  译:动画重复特定的次数,变化速率以正弦曲线变化

DecelerateInterpolator

  动作效果:An interpolator where the rate of change starts out quickly and and then decelerates.
  译:以一个极快的速率开始慢慢减速

LinearInterpolator

  动作效果:An interpolator where the rate of change is constant
  译:匀速变化

OvershootInterpolator

  动作效果:An interpolator where the change flings forward and overshoots the last value then comes back.
  译:向前甩一定值后再回到原来位置

Interpolator的用法

  xml用法:
  

android:interpolator="@android:anim/accelerate_decelerate_interpolator"

  代码用法:

mRotateAnimation.setInterpolator(this,android.R.anim.accelerate_interpolator);

结尾

  Interpolator的就简单介绍这些,Interpolator也是可以支持自定义的,后面抽空再花时间研究一下。

1 0