标签:
手机屏幕的左上角为原心,分别向右和向下为正方向。由此为各种animation方向的标准
/** * Constructor to use when building a TranslateAnimation from code * * @param fromXType Specifies how fromXValue should be interpreted. One of * Animation.ABSOLUTE, Animation.RELATIVE_TO_SELF, or * Animation.RELATIVE_TO_PARENT. * @param fromXValue Change in X coordinate to apply at the start of the * animation. This value can either be an absolute number if fromXType * is ABSOLUTE, or a percentage (where 1.0 is 100%) otherwise. * @param toXType Specifies how toXValue should be interpreted. One of * Animation.ABSOLUTE, Animation.RELATIVE_TO_SELF, or * Animation.RELATIVE_TO_PARENT. * @param toXValue Change in X coordinate to apply at the end of the * animation. This value can either be an absolute number if toXType * is ABSOLUTE, or a percentage (where 1.0 is 100%) otherwise. * @param fromYType Specifies how fromYValue should be interpreted. One of * Animation.ABSOLUTE, Animation.RELATIVE_TO_SELF, or * Animation.RELATIVE_TO_PARENT. * @param fromYValue Change in Y coordinate to apply at the start of the * animation. This value can either be an absolute number if fromYType * is ABSOLUTE, or a percentage (where 1.0 is 100%) otherwise. * @param toYType Specifies how toYValue should be interpreted. One of * Animation.ABSOLUTE, Animation.RELATIVE_TO_SELF, or * Animation.RELATIVE_TO_PARENT. * @param toYValue Change in Y coordinate to apply at the end of the * animation. This value can either be an absolute number if toYType * is ABSOLUTE, or a percentage (where 1.0 is 100%) otherwise. */ public TranslateAnimation(int fromXType, float fromXValue, int toXType, float toXValue, int fromYType, float fromYValue, int toYType, float toYValue) { mFromXValue = fromXValue; mToXValue = toXValue; mFromYValue = fromYValue; mToYValue = toYValue; mFromXType = fromXType; mToXType = toXType; mFromYType = fromYType; mToYType = toYType; }
/** * Constructor to use when building a RotateAnimation from code * * @param fromDegrees Rotation offset to apply at the start of the * animation. * * @param toDegrees Rotation offset to apply at the end of the animation. * * @param pivotX The X coordinate of the point about which the object is * being rotated, specified as an absolute number where 0 is the left * edge. * @param pivotY The Y coordinate of the point about which the object is * being rotated, specified as an absolute number where 0 is the top * edge. */
//旋转表示一个控件绕着一个点做旋转(平面旋转)。这个旋转是围绕一个点,而这个点是由百分比决定的,比如相对于自身时x为0.5,y为0.5,那么这个点就是该控件的中心;如果x为1,y为1,那么这个点就是控件的右下角;相对父控件时x为0.5,y为0.5,那么这个点就是该父控件的中心。
public RotateAnimation(float fromDegrees, float toDegrees, float pivotX, float pivotY) { mFromDegrees = fromDegrees; mToDegrees = toDegrees; mPivotXType = ABSOLUTE; mPivotYType = ABSOLUTE; mPivotXValue = pivotX; mPivotYValue = pivotY; initializePivotPoint(); }
/** * Constructor to use when building a ScaleAnimation from code * * @param fromX Horizontal scaling factor to apply at the start of the * animation * @param toX Horizontal scaling factor to apply at the end of the animation * @param fromY Vertical scaling factor to apply at the start of the * animation * @param toY Vertical scaling factor to apply at the end of the animation */ public ScaleAnimation(float fromX, float toX, float fromY, float toY) { mResources = null; mFromX = fromX; mToX = toX; mFromY = fromY; mToY = toY; mPivotX = 0; mPivotY = 0; }
/** * Constructor to use when building an AlphaAnimation from code * * @param fromAlpha Starting alpha value for the animation, where 1.0 means * fully opaque and 0.0 means fully transparent. * @param toAlpha Ending alpha value for the animation. */
//fromAlpha:开始时刻的透明度,取值范围0~1。
//toAlpha:结束时刻的透明度,取值范围0~1。
public AlphaAnimation(float fromAlpha, float toAlpha) { mFromAlpha = fromAlpha; mToAlpha = toAlpha; }
标签:
原文地址:http://www.cnblogs.com/could-deng/p/5030802.html