In order to create animations in TweenJS, you don't have to work with a lot of methods. There are a few functions that help you to create animations. Following are all the methods with a brief description:
get
: It returns a new tween instance.to
: It queues a tween from the current values to the target properties.set
: It queues an action to set the specified properties on the specified target.wait
: It queues a wait (essentially an empty tween).call
: It queues an action to call the specified function.play
: It queues an action to play (un-pause) the specified tween.pause
: It queues an action to pause the specified tween.The following is an example of using the Tweening API:
var tween = createjs.Tween.get(myTarget).to({x:300},400).set({label:"hello!"}).wait(500).to({alpha:0,visible:false},1000).call(onComplete);
The previous example will create a tween, which:
x
value of 300
with duration 400
ms and sets its label
to hello!
.500
ms.alpha
property to 0
with duration 1
s and sets the visible
property to false
.onCom
plete
function.3.141.3.175