sb.animationCreate(fps, [autoDestroy], [endCallback])

Create a new animation at the desired frame rate (fps). The second parameter (optional), auto_destroy, tells if the animation should be released once completed. If you specify a value of 1 the animation will be released and the returned id is not valid once the animation has completed. The third parameter (optional) indicates a callback function to be invoked when the animation is complete.

    fps             The animation frame rate
    autoDestroy     Pass 1 in to release the animation once completed
    endCallback     Provide a JavaScript function to be called at the end of the animation

    An animation id to be used on future animation calls, null on failure.

function animationCreate(fps) {    
    var id = sb.animationCreate(fps);

//Example of creating an animation with an animation complete callback
var animationState = "STOPPED";
function animationCreate1(fps) {    
    var id = sb.animationVreate(fps, 0, animationComplete);    
    sb.animationTrigger(id, {context="my_layer.my_control", id="my_control_animation"});        
    animationState = "RUNNING";

//The callback's first argument will be the completed animation's id.
//When triggered with an animation instance id (e.g., "my_control_animation"),
//otherwise it will be the id returned from calling animation_create.
function animation_complete(id) {    
    animationState = "COMPLETED"
Was this article helpful?
0 out of 0 found this helpful