springroll.AnimatorTimeline Class
Animator Instance is a wrapper for different types of media
files. They need to extend some basic methods.
_nextItem
()
private
Advances to the next item in the list of things to play.
beginAnim
Sets up variables that are needed (including duration), and does any other setup else needed.
Parameters:
-
animObj
Object
The animation data object.
-
isRepeat
Boolean
If this animation is restarting a loop.
create
springroll.AnimatorInstance
static
Get an instance either from a recycled pool or new
Parameters:
-
clip
The animation clip or display object
Returns:
springroll.AnimatorInstance:
The new instance
destroy
()
Reset this animator instance
so it can be re-used.
destroy
()
Reset this animator instance
so it can be re-used.
extend
(
-
InstanceClass
-
[ParentClass=springroll.AnimatorTimeline]
)
Object
Create pool and add create and remove functions
Parameters:
-
InstanceClass
Function
-
[ParentClass=springroll.AnimatorTimeline]
Function
optional
Returns:
Object:
The prototype for new class
getDuration
Number
static
Calculates the duration of an animation or list of animations.
Parameters:
-
clip
-
event
String
The animation or animation list.
Returns:
Number:
Animation duration in milliseconds.
getDuration
Number
static
Calculates the duration of an animation or list of animations.
Returns:
Number:
Animation duration in milliseconds.
hasAnimation
Boolean
static
Determines if a clip has an animation.
Parameters:
-
clip
The clip to check for an animation.
-
event
String | Object
Returns:
Boolean:
If the clip has the animation.
hasAnimation
Boolean
static
Checks if animation exists
Parameters:
-
clip
The clip to check for an animation.
-
event
String
The frame label event (e.g. "onClose" to "onClose_stop")
Returns:
Boolean:
does this animation exist?
init
The initialization method
init
The initialization method
pool
static
Recycle an instance to the class's pool
Parameters:
-
instance
springroll.AnimatorInstance
setPosition
Updates position to a new value, and does anything that the clip needs, like updating
timelines.
Parameters:
-
newPos
Number
The new position in the animation.
setPosition
Updates position to a new value, and does anything that the clip needs, like updating
timelines.
Parameters:
-
newPos
Number
The new position in the animation.
test
()
Boolean
static
Check to see if a clip is compatible with this
Returns:
Boolean:
if the clip is supported by this instance
test
()
Boolean
static
Check to see if a clip is compatible with this
Returns:
Boolean:
if the clip is supported by this instance
_paused
Boolean
private
If the timeline is paused.
_pool
Array
protected
static
The pool of used up instances
clip
The animation clip to play
complete
Boolean
If the timeline is complete. Looping timelines will never complete.
currentName
String
The name of the current animation.
duration
Number
The current animation duration in seconds.
duration
Number
Duration, in seconds, of the current animation.
eventList
Array
An array of animations and pauses.
firstFrame
Int
The frame number of the first frame of the current animation. If this is -1, then the
animation is currently a pause instead of an animation.
instance
springroll.AnimatorInstance
The instance of the timeline to animate
isLooping
Boolean
If the current animation loops - determined by looking to see if it ends
in "_stop" or "_loop"
isLooping
Boolean
If the current animation is a looping animation.
lastFrame
Int
The frame number of the last frame of the current animation.
length
Int
Length of current animation in frames.
listIndex
Int
The index of the active animation in eventList.
onCancelled
Function
The function to call when stopped early.
onComplete
Function
The function to call when we're done
paused
Boolean
Sets and gets the animation's paused status.
playSound
Boolean
If the timeline will, but has yet to play a sound for the current animation.
position
Number
Time, in seconds, of the current animation playback, from 0 -> duration.
soundAlias
String
Sound alias to sync to during the current animation.
soundEnd
Number
The time (seconds) into the animation that the sound ends
soundInst
Object
A sound instance object from springroll.Sound, used for tracking sound
position for the current animation.
soundStart
Number
The time (seconds) into the current animation that the sound starts.
speed
Number
The animation speed for the current animation. Default is 1.
startTime
Number
The start time of the current animation on the movieclip's timeline.
time
Number
The position of the current animation, or the current pause timer, in milliseconds.
useCaptions
Boolean
If this timeline plays captions for the current sound.