Timeline API Reference


b5.Timeline

Animation is accomplished using timelines, a Timeline manages a collection of Animations. A timeline is a collection of animations with each animation targeting a specific property of a specific object. Multiple frames of animation can be attached to the same animation. Once an animation has been created it should be added to either a scene TimelineManager or global app timeline manager in order for it to be processed. This enables all timelines to be paused when a scene is deactivated.

Public Properties

  • anims – An array of Animations
  • manager – The parent timeline manager that manages this timeline
  • name – The name of this timeline

Methods

Timeline(target, property, frames, times, repeat, easing) – Creates an instance of a Timeline object

  • target – The target object that will have its properties animated
  • property – The name of the property that will be animated
  • frames – An array of key frame values that represent the value of the property at each time slot
  • times – An array of time values that represent the time at which each key frame should be used
  • repeat – the total number of times that the animation should repeat (0 for forever)
  • easing – An array of easing values (optional), see Ease for reference

add(target, property, frames, times, repeat, easing) – Adds an Animation object to this timelnie

  • target – The target object that will have its properties animated
  • property – The name of the property that will be animated
  • frames – An array of key frame values that represent the value of the property at each time slot
  • times – An array of time values that represent the time at which each key frame should be used
  • repeat – the total number of times that the animation should repeat (0 for forever)
  • easing – An array of easing values (optional), see Ease for reference

remove(animation) – Removes the specified animation from the timeline

find(name) – Finds and returns the named animation or null if not found

pause() – Pauses all Animations in the timeline

play() – Plays all Animations in the timeline

restart() – Restarts all Animations in the timeline

print() - Debug method which prints out a list of animations in the timeline

update(dt) – Updates all Animations in the timeline

  • dt – The amount of time that has passed since this timeline was last updated

Examples

Example of creating a simple animation

Example of creating a more complex timeline animation

 

963 total views, 1 views today