Android Animation详解一

讲解anroid.view.animation


Animation

Abstraction for an Animation that can be applied to Views, Surfaces, or other objects. See the  animation package description file .
public abstract class Animation implements Cloneable {...}

该类是一个抽象类,实现Cloneable,可以clone克隆。它的子类包括AlphaAnimation, AnimationSet, RotateAnimation, ScaleAnimation, TranslateAnimation。

AlphaAnimation

RotateAnimation
ScaleAnimation
TranslateAnimation

AnimationSet
Represents a group of Animations that should be played together。
Constructor to use when building an AnimationSet from code
Parameters:
shareInterpolator Pass true if all of the animations in this set should use the interpolator associated with this AnimationSet. Pass false if each animation should use its own interpolator.
AnimationSet(boolean shareInterpolator)。

Interpolator
<span style="font-size:12px;">public interface Interpolator extends TimeInterpolator{...}</span>
被用来修饰动画效果,定义动画的变化率,可以使存在的动画效果accelerated(加速),decelerated(减速),repeated(重复),bounced(弹跳)等。

AccelerateDecelerateInterpolator
在动画开始与结束的地方速率改变比较慢,在中间的时候加速

AccelerateInterpolator
在动画开始的地方速率改变比较慢,然后开始加速

AnticipateInterpolator
开始的时候向后然后向前甩

AnticipateOvershootInterpolator
开始的时候向后然后向前甩一定值后返回最后的值

BounceInterpolator
动画结束的时候弹起

CycleInterpolator
动画循环播放特定的次数,速率改变沿着正弦曲线

DecelerateInterpolator
在动画开始的地方快然后慢

LinearInterpolator
以常量速率改变

OvershootInterpolator
向前甩一定值后再回到原来位置

Transformation

在绘制Tween动画的时候用的,Tween动画的实质就是ParentView不断的调整childView的Canvas的坐标来实现的,在dispathdraw()中,Animation a = ChildView.getAnimation();Transformation tm = a.getTransformation(); //Transformation 中包含一个矩阵和 alpha 值,矩阵是用来做平移、旋转和缩放动画的,通过tm来设置子控件的canvas。

  • 1
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值