new Animation(target, params)
Parameters:
Name | Type | Description |
---|---|---|
target | Object | Any object that will be changed its properties by the animation. Usually the object is a display object. |
params | Object | An object containing various properties of the target object that you want to animate on the target objects with the final values, a duration and a transition type. If multiple objects are specified, the values of the properties will be changed sequentially. The target object should implements a getter and a setter of the properties. The format of the getter is "getProperty" and the setter is "setProperty". |
Example
//Takes 0.5 seconds to move its position to x:10, y:10 with a SINE_OUT transition, and after that takes 1 second to move its position to x:20, y:30 with a SINE_IN transition.
var anim = new arc.anim.Animation(target,
{x:10, y:10, time:500, transition:arc.anim.Transition.SINE_OUT},
{x:20, y:30, time:1000, transition:arc.anim.Transition.SINE_OUT});
anim.play();
Methods
-
addEventListener(type, callback)
-
Registers an event listener object to EventDispatcher object so that the listener receives the notification.
Parameters:
Name Type Description type String The type of event. callback Function The listener function. -
dispatchEvent(Event)
-
Dispatches an event to the event flow.
Parameters:
Name Type Description Event arc.Event object -
isPlaying() → {Boolean}
-
Determines if the animtion is playing.
Returns:
Boolean If true the animation is playing -
play(shouldReplay)
-
Playes the animation.
Parameters:
Name Type Description shouldReplay Boolean If true the animation will be looped -
removeEventListener(type, callback)
-
Removes a listener from the EventDispatcher object.
Parameters:
Name Type Description type String The type of event. callback Function The listener function. -
stop()
-
Stops the animation.