android AnimationSet

AnimationSet: Representsa group of Animations that should be played together. The transformation ofeach individual animation are composed together into a single transform. IfAnimationSet sets any properties that its children also set (for example, durationor fillBefore), the values of AnimationSet override the child values.

在Android 中用于制作混合型动画

AnimationSet.setInterpolator:Sets the acceleration curve for this animation. Defaults to a linearinterpolation.

AnimationSet.setRepeatMode():efineswhat this animation should do when it reaches the end. This setting is appliedonly when the repeat count is either greater than 0 or INFINITE. Defaultsto RESTART.

AnimationSet 可以包含多个Animation,但都是在同一个时间执行的,是并行,不是串行执行的。
如果AnimationSet中有一些设定,如duration,fillBefore等,它包含的子动作也设定了的话,

子动作中的设定将会给覆盖掉。

旋转动画

<rotate
	android:fromDegrees="-2" 
        android:toDegrees="+2"         
        android:pivotX="50%" 
        android:pivotY="50%"         
        android:duration="1000"
	android:repeatCount="infinite"
	android:repeatMode="reverse"
/> 

android:pivotX="50%" 表示旋转点相对于整个控件的水平坐标。

android:pivotY="50%" 表示旋转点相对于整个控件的垂直坐标。

android:fromDegrees 表示从相对于竖直位置的偏移值处开始旋转。

android:toDegrees表示旋转到相对于竖直位置的偏移值处。

android:duration表示动画持续的时间

android:repeatCount表示动画重复的次数

android:repeatMode 表示动画重复模式

透明度动画

<alpha 
	android:fromAlpha="1.0" 
	android:toAlpha="0.2" 
	android:duration="2000"
	android:repeatMode="reverse"
	android:repeatCount="infinite" />

fromAlpha 属性为动画起始时透明度

toAlpha   属性为动画结束时透明度



评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值