[ view source ]
class Timeline
package ceramic
extends Entity
implements Component
Available on all targets
Events
startLabel(index:Int, name:String):Void
Triggered when position reaches an existing label
Parameters:
index | label index (position) |
---|---|
name | label name |
Constructor
Variables
size:Int = 0
Timeline size. Default 0
, meaning this timeline won't do anything.
By default, because autoFitSize
is true
, adding or updating tracks on this
timeline will update timeline size
accordingly so it may not be needed to update size
explicitly.
Setting size
to -1
means the timeline will never finish.
autoFitSize:Bool = true
If set to true
(default), adding or updating tracks on this timeline will update
timeline size accordingly to match longest track size.
autoUpdate:Bool = true
Whether this timeline should bind itself to update cycle automatically or not (default true
).
fps:Int = 30
Frames per second on this timeline. Note: a lower fps doesn't mean animations won't be interpolated between frames. Thus using 30 fps is still fine even if screen refreshes at 60 fps.
read onlyposition:Float = 0
Position on this timeline.
Gets back to zero when loop=true
and position reaches a defined size
.
read onlytracks:ReadOnlyArray<TimelineTrack<TimelineKeyframe>> = []
The tracks updated by this timeline
read onlylabels:ReadOnlyArray<String> = null
Used in pair with labelIndexes
to manage timeline labels
startPosition:Int = -1
If >= 0, timeline will start from this index. When timeline is looping, it will reset to this index as well at each iteration.
endPosition:Int = -1
If provided, timeline will stop at this index. When timeline is looping, it will reset to startIndex (if >= 0).
read onlyinitializerName:String = null
Methods
finalseek(targetPosition:Float):Void
Seek the given position (in frames) in the timeline.
Will take care of clamping position
or looping it depending on size
and loop
properties.
animate(name:String, complete:() ‑> Void):Void
Animate starting from the given label name and calls complete when reaching the end of label area (= when animation finishes). If animation is interrupted (by playing another animation, seeking another position...), complete won't be called.
Parameters:
name | Label name |
---|---|
complete | callback fired when animation finishes. |
seekLabel(name:String):Int
Seek position to match the given label
Parameters:
name | Label name |
---|
Returns:
The index (position) of the looping label, or -1 if no label was found
loopLabel(name:String):Int
Seek position to match the given label and set startPosition and endPosition so that it will loop through the whole area following this label, up to the position of the next label or the end of the timeline.
Parameters:
name | Label name |
---|
Returns:
The index (position) of the looping label, or -1 if no label was found