addListener

将侦听器添加到一组侦听器中,这些侦听器在动画的整个生命周期(如开始、重复和结束)中发送事件。

示例:

  1. animate.addListener(Animator.AnimatorListener{
  2. onAnimationCancel=function(animation)
  3. print("动画取消")
  4. end,
  5. onAnimationEnd=function(animation)
  6. print("动画结束")
  7. end,
  8. onAnimationRepeat=function(animation)
  9. print("动画重复")
  10. end,
  11. onAnimationStart=function(animation)
  12. print("动画开始")
  13. end
  14. })

setDuration

设置动画的持续时间。单位为毫秒。

setInterpolator

设置插值器,即控制你的动画速率。

常见的插值器有:

差值器 描述
AccelerateDecelerateInterpolator 一个开始和结束缓慢但中间加速的插值器
AccelerateInterpolator 一个开始缓慢然后加速的插值器
AnticipateOvershootInterpolator 一个插值器,它开始向后,然后向前,超过目标值,最后回到最终值
BounceInterpolator 一个在末端反弹的插值器
CycleInterpolator 重复指定周期数的动画。变化率呈正弦曲线
DecelerateInterpolator 一个开始很快然后减速的插值器
LinearInterpolator 变化率为常数的插值器
OvershootInterpolator 一个内插器,向前移动并超过最后一个值,然后返回

setStartDelay

延迟处理动画的时间,以毫秒为单位。

start

开始动画