旋转动画——RotateAnimation的讲解

本来想上网找一个讲RotateAnimation的博文,发现质量都良莠不齐,而且排版非常烂,只能自己写一篇了……


RotateAnimation类:


一、文档介绍:

public class RotateAnimation
   
   
    
    extends Animation
   
   

An animation that controls the rotation of an object. This rotation takes place int the X-Y plane. You can specify the point to use for the center of the rotation, where (0,0) is the top left point. If not specified, (0,0) is the default rotation point.

【请允许我蹩脚的翻译一下:RotateAnimation是能够让一个对象旋转的Animation子类。这里所说的旋转只在X,Y轴构成的平面上进行。你可以选择一个点作为旋转的圆心点,如果没有对旋转中心点进行设置的话,默认为(0,0)】


二、构造方法:

RotateAnimation(Context context, AttributeSet attrs) 
RotateAnimation(float fromDegrees, float toDegrees) 
RotateAnimation(float fromDegrees, float toDegrees, float pivotX, float pivotY) 
RotateAnimation(float fromDegrees, float toDegrees, int pivotXType, float pivotXValue, int pivotYType, float pivotYValue) 
我讲一下这里的关键参数:

fromDegrees和toDegrees:这两个分别是旋转的起始角度和结束角度。我下面会放一张图帮助大家理解。

pivotX和pivotY:是旋转的中心点的X,Y坐标

pivotXType和pivotYType:X,Y轴的伸缩模式,定义了pivotXValue和pivotYValue怎么被使用

pivotXValue和pivotYValue:在X,Y方向的位置,但是会受pivotXType和pivotYType的影响。


RotateAnimation角度的变化是从X轴正方向开始,顺时针方向旋转。



  • 1
    点赞
  • 6
    收藏
    觉得还不错? 一键收藏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值