public class RotateAnimation
extends Animation
java.lang.Object | ||
↳ | android.view.animation.Animation | |
↳ | android.view.animation.RotateAnimation |
控制对象旋转的动画。 这种旋转发生在XY平面上。 您可以指定要用于旋转中心的点,其中(0,0)是左上角的点。 如果未指定,则(0,0)是默认的旋转点。
Inherited XML attributes |
|
---|---|
From class android.view.animation.Animation
|
Inherited constants |
---|
From class android.view.animation.Animation
|
Public constructors |
|
---|---|
RotateAnimation(Context context, AttributeSet attrs) 从资源加载RotateAnimation时使用的构造函数。 |
|
RotateAnimation(float fromDegrees, float toDegrees) 从代码构建RotateAnimation时使用的构造函数。 |
|
RotateAnimation(float fromDegrees, float toDegrees, float pivotX, float pivotY) 从代码构建RotateAnimation时使用的构造函数 |
|
RotateAnimation(float fromDegrees, float toDegrees, int pivotXType, float pivotXValue, int pivotYType, float pivotYValue) 从代码构建RotateAnimation时使用的构造函数 |
Public methods |
|
---|---|
void |
initialize(int width, int height, int parentWidth, int parentHeight) 使用被动画对象的维度以及对象父项来初始化此动画。 |
Protected methods |
|
---|---|
void |
applyTransformation(float interpolatedTime, Transformation t) 帮助getTransformation。 |
Inherited methods |
|
---|---|
From class android.view.animation.Animation
|
|
From class java.lang.Object
|
RotateAnimation (Context context, AttributeSet attrs)
从资源加载RotateAnimation时使用的构造函数。
Parameters | |
---|---|
context |
Context : Application context to use |
attrs |
AttributeSet : Attribute set from which to read values |
RotateAnimation (float fromDegrees, float toDegrees)
从代码构建RotateAnimation时使用的构造函数。 默认的pivotX / pivotY点是(0,0)。
Parameters | |
---|---|
fromDegrees |
float : Rotation offset to apply at the start of the animation. |
toDegrees |
float : Rotation offset to apply at the end of the animation. |
RotateAnimation (float fromDegrees, float toDegrees, float pivotX, float pivotY)
从代码构建RotateAnimation时使用的构造函数
Parameters | |
---|---|
fromDegrees |
float : Rotation offset to apply at the start of the animation. |
toDegrees |
float : Rotation offset to apply at the end of the animation. |
pivotX |
float : The X coordinate of the point about which the object is being rotated, specified as an absolute number where 0 is the left edge. |
pivotY |
float : The Y coordinate of the point about which the object is being rotated, specified as an absolute number where 0 is the top edge. |
RotateAnimation (float fromDegrees, float toDegrees, int pivotXType, float pivotXValue, int pivotYType, float pivotYValue)
从代码构建RotateAnimation时使用的构造函数
Parameters | |
---|---|
fromDegrees |
float : Rotation offset to apply at the start of the animation. |
toDegrees |
float : Rotation offset to apply at the end of the animation. |
pivotXType |
int : Specifies how pivotXValue should be interpreted. One of Animation.ABSOLUTE, Animation.RELATIVE_TO_SELF, or Animation.RELATIVE_TO_PARENT. |
pivotXValue |
float : The X coordinate of the point about which the object is being rotated, specified as an absolute number where 0 is the left edge. This value can either be an absolute number if pivotXType is ABSOLUTE, or a percentage (where 1.0 is 100%) otherwise. |
pivotYType |
int : Specifies how pivotYValue should be interpreted. One of Animation.ABSOLUTE, Animation.RELATIVE_TO_SELF, or Animation.RELATIVE_TO_PARENT. |
pivotYValue |
float : The Y coordinate of the point about which the object is being rotated, specified as an absolute number where 0 is the top edge. This value can either be an absolute number if pivotYType is ABSOLUTE, or a percentage (where 1.0 is 100%) otherwise. |
void initialize (int width, int height, int parentWidth, int parentHeight)
使用被动画对象的维度以及对象父项来初始化此动画。 (这是为了支持相对于这些尺寸指定的动画尺寸。)
解释动画的对象在调用 getTransformation(long, Transformation)
之前 getTransformation(long, Transformation)
知道 getTransformation(long, Transformation)
对象的大小及其父对象的大小。
Parameters | |
---|---|
width |
int : Width of the object being animated |
height |
int : Height of the object being animated |
parentWidth |
int : Width of the animated object's parent |
parentHeight |
int : Height of the animated object's parent |
void applyTransformation (float interpolatedTime, Transformation t)
帮助getTransformation。 子类应该实现这个以应用赋予插值的变换。 此方法的实现应始终替换指定的转换或其他文档。
Parameters | |
---|---|
interpolatedTime |
float : The value of the normalized time (0.0 to 1.0) after it has been run through the interpolation function. |
t |
Transformation : The Transformation object to fill in with the current transforms. |