Events

@:dox(show)startLabel(index:Int, name:String):Void

Triggered when position reaches an existing label

Parameters:

index

label index (position)

name

label name

@:dox(show)endLabel(index:Int, name:String):Void

Triggered when position reaches the end of an area following the given label. Either when a new label was reached or when end of timeline was reached

Parameters:

index

label index (position)

name

label name

Constructor

new()

Variables

@:value(0)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.

@:value(true)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.

@:value(true)loop:Bool = true

Whether this timeline should loop. Ignored if timeline's size is -1 (not defined).

@:value(true)autoUpdate:Bool = true

Whether this timeline should bind itself to update cycle automatically or not (default true).

@:value(30)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.

@:value(0)read onlyposition:Float = 0

Position on this timeline. Gets back to zero when loop=true and position reaches a defined size.

@:value([])read onlytracks:ReadOnlyArray<TimelineTrack<TimelineKeyframe>> = []

The tracks updated by this timeline

@:value(false)paused:Bool = false

Whether this timeline is paused or not.

@:value(null)read onlylabels:ReadOnlyArray<String> = null

Used in pair with labelIndexes to manage timeline labels

@:value(-1)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.

@:value(-1)endPosition:Int = -1

If provided, timeline will stop at this index. When timeline is looping, it will reset to startIndex (if >= 0).

@:value(null)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

resetStartAndEndPositions():Void

Reset startPosition and endPosition

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

@:value({ forceChange : false })finalapply(forceChange:Bool = false):Void

Apply (or re-apply) every track of this timeline at the current position

add(track:TimelineTrack<TimelineKeyframe>):Void

Add a track to this timeline

remove(track:TimelineTrack<TimelineKeyframe>):Void

Remove a track from this timeline

fitSize():Void

Update size property to make it fit the size of the longuest track.

setLabel(index:Int, name:String):Void

Inherited Events

Defined by Entity

@:dox(show)dispose(entity:Entity):Void

@:dox(show)destroy(entity:Entity):Void

Inherited Variables

Defined by Entity

read onlyhasData:Bool

@:value(null)id:String = null

read onlydestroyed:Bool

read onlydisposed:Bool

@:value(null)read onlyautoruns:Array<Autorun> = null

@editablecomponents:ReadOnlyMap<String, Component>

Public components mapping. Contain components created separately with component() or macro-based components as well.

scriptContent:ScriptContent

Available with script plugin

script:Script

Available with script plugin

Inherited Methods

Defined by Entity

destroy():Void

Destroy this entity. This method is automatically protected from duplicate calls. That means calling multiple times an entity's destroy() method will run the destroy code only one time. As soon as destroy() is called, the entity is marked destroyed=true, even when calling destroy() method on a subclass (a macro is inserting a code to mark the object as destroyed at the beginning of every destroy() override function.

dispose():Void

Schedules destroy, at the end of the current frame.

unbindEvents():Void

Remove all events handlers from this entity.

autorun(run:() ‑> Void, ?afterRun:() ‑> Void):Autorun

Creates a new Autorun instance with the given callback associated with the current entity.

Parameters:

run

The run callback

Returns:

The autorun instance

tween(?easing:Easing, duration:Float, fromValue:Float, toValue:Float, update:(Float, Float) ‑> Void):Tween

component<C>(?name:String, ?component:Null<C>):C