动画初步

mac2022-06-30  22

   

Tween动画有四个主要的实现,下面分别说明下:

AlphaAnimation:渐变动画 主要控制透明度变化动画类 ScaleAnimation:主要控制尺度变化的动画类 TranslateAnimation:主要控制位置变换的动画实现类 RotateAnimation:主要控制旋转的动画实现类     1、AlphaAnimation:渐变动画,主要控制透明度变化动画类,常使用AlphaAnimation(float fromAlpha, float toAlpha)来构造;     fromAlpha:动画开始时的透明度(取值范围为0.0到1.0);     toAlpha:动画结束时的透明度; 2、ScaleAnimation:主要控制尺度变化的动画类,常使用ScaleAnimation(float fromX, float toX, float fromY, float toY, int pivotXType, float pivotXValue, int pivotYType, float pivotYValue)来构造;     fromX:动画开始X坐标上的伸缩尺度;     toX:动画结束X坐标上的伸缩尺度;     fromY:动画开始Y坐标上的伸缩尺度;     toY:动画结束Y坐标上的伸缩尺度;     pivotXType:X坐标上的伸缩模式,取值有:Animation.ABSOLUTE, Animation.RELATIVE_TO_SELF, Animation.RELATIVE_TO_PARENT;     pivotXValue:X坐标上的伸缩值;     pivotYType:Y坐标上的伸缩模式,取值有:Animation.ABSOLUTE, Animation.RELATIVE_TO_SELF, Animation.RELATIVE_TO_PARENT;     pivotYValue:Y坐标上的伸缩值; 3、TranslateAnimation:主要控制位置变换的动画实现类,常使用TranslateAnimation(float fromXDelta, float toXDelta, float fromYDelta, float toYDelta)来构造;     fromXDelta:动画开始的X坐标;     toXDelta:动画结束的X坐标;     fromYDelta:动画开始的Y坐标;     toYDelta:动画结束的Y坐标; 4、RotateAnimation:主要控制旋转的动画实现类,常使用RotateAnimation(float fromDegrees, float toDegrees, int pivotXType, float pivotXValue, int pivotYType, float pivotYValue)来构造;     fromDegrees:旋转开始角度;     toDegrees:旋转结束角度;     pivotXType, pivotXValue, pivotYType, pivotYValue与尺度变化动画ScaleAnimation类似;  

转载于:https://www.cnblogs.com/montahan/p/4236280.html

相关资源:android XML动画初步解析(activity界面之间跳转demo)
最新回复(0)