This component provides the capability of changing values in a non-linear manner. It is mainly used in basic animations for the scaling ratio and transparency to change in a non-linear manner. To use this component, you need to set the varSpeedFlag attribute in an animation. This attribute supports 30 function types and takes effect on the target frame and its next frame. For example, you can use a variable-speed function in a position animation to control the speed for moving from the start position to the end position.
Currently, the following animation types support variable-speed functions: <AlphaAnimation>, <PositionAnimation>, <RotationAnimation>, <SizeAnimation>, and <VariableAnimation>.
This section describes typical XML specifications based on <PositionAnimation>, and the specifications for other animation types such as <AlphaAnimation> and <RotationAnimation> are similar.
<PositionAnimation>
<Position x="" y="" time="" varSpeedFlag=""/>
<Position x="" y="" time="" />
</PositionAnimation> Variable-speed functions supported in varSpeedFlag
Parameter | Type | Mandatory | Description |
|---|---|---|---|
SineFun_In | String | No | Ease-in following a sine curve. |
SineFun_Out | String | No | Ease-out following a sine curve. |
SineFun_InOut | String | No | Ease-in-out following a sine curve. |
QuadFun_In | String | No | Ease-in following a quadratic curve. |
QuadFun_Out | String | No | Ease-out following a quadratic curve. |
QuadFun_InOut | String | No | Ease-in-out following a quadratic curve. |
CubicFun_In | String | No | Ease-in following a cubic curve. |
CubicFun_Out | String | No | Ease-out following a cubic curve. |
CubicFun_InOut | String | No | Ease-in-out following a cubic curve. |
QuartFun_In | String | No | Ease-in following a quartic curve. |
QuartFun_Out | String | No | Ease-out following a quartic curve. |
QuartFun_InOut | String | No | Ease-in-out following a quartic curve. |
QuintFun_In | String | No | Ease-in following a quintic curve. |
QuintFun_Out | String | No | Ease-out following a quintic curve. |
QuintFun_InOut | String | No | Ease-in-out following a quintic curve. |
ExpoFun_In | String | No | Ease-in following an exponential curve. |
ExpoFun_Out | String | No | Ease-out following an exponential curve. |
ExpoFun_InOut | String | No | Ease-in-out following an exponential curve. |
CircFun_In | String | No | Ease-in following a circular curve. |
CircFun_Out | String | No | Ease-out following a circular curve. |
CircFun_InOut | String | No | Ease-in-out following a circular curve. |
BackFun_In | String | No | Ease-in following a cubic curve exceeding the range. |
BackFun_Out | String | No | Ease-out following a cubic curve exceeding the range. |
BackFun_InOut | String | No | Ease-in-out following a cubic curve exceeding the range. |
ElasticFun_In | String | No | Ease-in following a sine curve with exponential decay. |
ElasticFun_Out | String | No | Ease-out following a sine curve with exponential decay. |
ElasticFun_InOut | String | No | Ease-in-out following a sine curve with exponential decay. |
BounceFun_In | String | No | Ease-in following a bounce curve with exponential decay. |
BounceFun_Out | String | No | Ease-out following a bounce curve with exponential decay. |
BounceFun_InOut | String | No | Ease-in-out following a bounce curve with exponential decay. |
Use SineFun_Out for the image ty.png when it moves from (0,0) to (500,0). The animation lasts for 4000 ms during this period. Note that no variable-speed function is used for the image when it moves from (500,0) to (800,0), and therefore the speed is uniform.
<Image x="100" y="690" centerX="136" centerY="351" src="ty.png">
<PositionAnimation>
<Position x="0" y="0" time="0" varSpeedFlag="SineFun_Out"/>
<Position x="500" y="0" time="4000"/>
<Position x="800" y="0" time="6000"/>
</PositionAnimation>
</Image>