svg.js
svg.js copied to clipboard
Timeline Management
We have found in using our current timelines, that we really want to be able to manipulate the playing behaviour of the timeline, in a step that is entirely separate from actually composing the timeline. So we have two different modes of operation for the timeline:
- Setup/sequencing: where we place or modify runners on the timeline
- Playing: where we let the timeline play
We have found that just having play
is way too restrictive, so we want to
add a few new mechanisms.
Looping and Play
We want to be able to play the timeline for a short period of time, and to loop it, for this we want to modify the behaviour of play:
timeline.play( duration=Infinity, start=0 )
Then we want to be able to loop
timeline.loop( duration=Infinity, start=0, times=1, swing=false )
This will allow the user to make up any complicated sequence they like.
Scenes and Repeating
The user may want to define sequences in the timeline as scenes
, a scene
is a combination of plays and loops, that the user can either play once
or repeat for as long as they like. The user can define a scene like this,
and they can make it repeat if they like:
timeline.scene('welcome')
.play( 300 )
.loop( 500, 200 )
.repeat()
Then the user can start a scene by naming it:
timeline.start('welcome')
Which will start it playing. Scenes don't start automatically, the user needs to start them when they want to play them, as they may have more than one scene hanging around.