RotateAnimationpublic 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. |
Fields Summary |
---|
private float | mFromDegrees | private float | mToDegrees | private int | mPivotXType | private int | mPivotYType | private float | mPivotXValue | private float | mPivotYValue | private float | mPivotX | private float | mPivotY |
Constructors Summary |
---|
public RotateAnimation(android.content.Context context, android.util.AttributeSet attrs)Constructor used when a RotateAnimation is loaded from a resource.
super(context, attrs);
TypedArray a = context.obtainStyledAttributes(attrs,
com.android.internal.R.styleable.RotateAnimation);
mFromDegrees = a.getFloat(
com.android.internal.R.styleable.RotateAnimation_fromDegrees, 0.0f);
mToDegrees = a.getFloat(com.android.internal.R.styleable.RotateAnimation_toDegrees, 0.0f);
Description d = Description.parseValue(a.peekValue(
com.android.internal.R.styleable.RotateAnimation_pivotX));
mPivotXType = d.type;
mPivotXValue = d.value;
d = Description.parseValue(a.peekValue(
com.android.internal.R.styleable.RotateAnimation_pivotY));
mPivotYType = d.type;
mPivotYValue = d.value;
a.recycle();
| public RotateAnimation(float fromDegrees, float toDegrees)Constructor to use when building a RotateAnimation from code.
Default pivotX/pivotY point is (0,0).
mFromDegrees = fromDegrees;
mToDegrees = toDegrees;
mPivotX = 0.0f;
mPivotY = 0.0f;
| public RotateAnimation(float fromDegrees, float toDegrees, float pivotX, float pivotY)Constructor to use when building a RotateAnimation from code
mFromDegrees = fromDegrees;
mToDegrees = toDegrees;
mPivotXType = ABSOLUTE;
mPivotYType = ABSOLUTE;
mPivotXValue = pivotX;
mPivotYValue = pivotY;
| public RotateAnimation(float fromDegrees, float toDegrees, int pivotXType, float pivotXValue, int pivotYType, float pivotYValue)Constructor to use when building a RotateAnimation from code
mFromDegrees = fromDegrees;
mToDegrees = toDegrees;
mPivotXValue = pivotXValue;
mPivotXType = pivotXType;
mPivotYValue = pivotYValue;
mPivotYType = pivotYType;
|
Methods Summary |
---|
protected void | applyTransformation(float interpolatedTime, Transformation t)
float degrees = mFromDegrees + ((mToDegrees - mFromDegrees) * interpolatedTime);
if (mPivotX == 0.0f && mPivotY == 0.0f) {
t.getMatrix().setRotate(degrees);
} else {
t.getMatrix().setRotate(degrees, mPivotX, mPivotY);
}
| public void | initialize(int width, int height, int parentWidth, int parentHeight)
super.initialize(width, height, parentWidth, parentHeight);
mPivotX = resolveSize(mPivotXType, mPivotXValue, width, parentWidth);
mPivotY = resolveSize(mPivotYType, mPivotYValue, height, parentHeight);
|
|