sb.animationStop
sb.animationStop(animationID, data)
// OR
sb.animationStop("animation_name")
Stop an animation. If an animationID is used to stop the animation, then it must be the return value from sb.animationCreate(). If a name is used to stop an animation, then that name must be the name of the animation specified in Designer. This function can take an optional parameter, data. The data parameter is an object that contains variables for the extra arguments to set.
Parameters
| Parameter | Type | Description |
|---|---|---|
animationID | string | The animation to stop |
data | object | An optional parameter containing extra arguments to set. See Animation Data Object for details. |
Animation Data Object
| Key | Type | Description |
|---|---|---|
id | string | The animation id used in the case of multiple animations with the same name |
context | string | The fully qualified name of an object in the model which will be used as the context for the animation |
Example
function create_animation(context) {
var data = {};
// slide the x position 400 pixels over 2000 ms and auto-destroy
// it on completion
var id = sb.animationCreate(60, 1);
data.rate = "linear";
data.duration = 2000;
data.offset = 0;
data.delta = 400;
data.key = "mylayer.mycontrol.grd_x";
sb.animationAddStep(id, data);
sb.animationTrigger(id);
//do stuff
//Stop the animation
sb.animationStop(id);
}
//Example of using sb.animationStop passing animation names.
function cbStopCur5day() {
if(cur5dayToggle == false) {
sb.animationStop("show_5day")
} else {
sb.animationStop("hide_mon_to_fri")
}
}
//Example of using sb.animationStop with context.
function cbToggleCur5day() {
var data = {};
data.context = "Layer1.mycontrol";
sb.animationStop("show_5day", data);
}