sb.animationAddStep
sb.animationAddStep(id, stepSata)
Add a step to a created animation. The id must be from a call to sb.animationCreate. The stepData parameter defines the animation step values. NOTE: If both "to" and "delta" are given then the "to" value is used.
Parameters
| Parameter | Type | Description |
|---|---|---|
id | number | The animation id to add the step to. |
stepData | object | An object containing the animation step values. See Step Data Object for details. |
Step Data Object
| Key | Type | Description |
|---|---|---|
key | string | The data key for the animation step to act upon. |
rate | string | The animation rate string: [linear |
duration | number | The length of the step (ms). |
offset | number | The offset from animation start where this step begins (ms). |
from | number | The value to start the animation at, if not specified the value is the current value of "key". |
to | number | The endpoint for the animation. |
delta | number | The delta for the end of the animation from the start point. |
Example:
function createAnimation() {
var stepData = {};
// slide the x position 400 pixels over 2000 ms and auto-destroy
// it on completion
var id = sb.animationCreate(60, 1);
stepData.rate = "linear";
stepData.duration = 2000;
stepData.offset = 0;
stepData.delta = 400;
stepData.key = "mylayer.mycontrol.grd_x";
sb.animationAddStep(id, stepData);
}