Jump to content
GreenSock

TweenLite.delayedCall()

TweenLite.delayedCall( delay:Number, callback:Function, params:Array , scope:*, useFrames:Boolean ) : TweenLite

[static] Provides a simple way to call a function after a set amount of time (or frames).

Parameters

delay: Number

Delay in seconds (or frames if useFrames is true) before the function should be called

callback: Function

Function to call

params: Array

(default = null) — An Array of parameters to pass the function (optional).

scope: *

(default = null) — The scope in which the callback should be called (basically, what “this” refers to in the function).

useFrames: Boolean

(default = false) — If the delay should be measured in frames instead of seconds, setuseFrames to true (default is false)

Details

Provides a simple way to call a function after a set amount of time (or frames). You can optionally pass any number of parameters to the function too.

//calls myFunction after 1 second and passes 2 parameters: 
TweenLite.delayedCall(1, myFunction, ["param1", 2]);

function myFunction(param1, param2) {
//do stuff
}
Copyright 2017, GreenSock. All rights reserved. This work is subject to theterms of useor for Club GreenSock members, the software agreement that was issued with the membership.
×