TimelinePlayback class
One timeline being played by one entity. The ECS system drives one per player component; an editor drives its own to preview, and a game can make one with no component at all.
- Implemented types
Constructors
-
TimelinePlayback(TimelineAsset asset, {required World world, required Entity owner, void onEvent(TimelineEventFired event)?, bool isPreview = false, int depth = 0, void onWillWrite(Component component, SchemaField field)?, Future<
TimelineAsset> loader(String path)?}) -
Plays
assetinworld. Tracks of a kind the asset was read without butworld's context knows (context.trackKinds) are read again first, so they play.
Properties
- asset → TimelineAsset
-
The timeline played, with the tracks the world's kinds could read
again already read (so not always the instance passed in).
final
- bounds → (double, double)
-
range made sense of: inside the timeline, in order, and the whole of
it when what was asked for is not a stretch of time.
no setter
- depth → int
-
How many timelines deep this one is nested; 0 for one a player plays.
final
- duration → double
-
The whole timeline, whatever this playback runs of it.
no setter
- effectiveWrap → TimelineWrap
-
The wrap in force: wrap when set, else the asset's own.
no setter
- hashCode → int
-
The hash code for this object.
no setterinherited
- isFinished → bool
-
A
oncetimeline got to its end (or, backwards, its start).no setter - isInterrupted → bool
-
Whether something an event set off — a handler that stopped, sought
or restarted the playback, or the one it is nested in — has changed
what is playing since this step began. A track that fires several
things in one step stops at the first that finds it true: what comes
after them is no longer happening.
no setteroverride
- isPlaying → bool
-
Whether the clock is running: set by play; cleared by pause,
stop, dispose and a
oncetimeline reaching its end.no setter - isPreview → bool
-
Whether the timeline is only being looked at (an editor scrubbing),
so a track must not do what cannot be undone — play a sound, fire a
signal.
final
- onEvent → void Function(TimelineEventFired event)?
-
Told, synchronously, of every event this playback fires — and every
one a timeline nested in it fires. Null ignores them.
final
- onWillWrite → void Function(Component component, SchemaField field)?
-
See TimelineContext.willWrite.
final
- owner → Entity
-
The entity whose player is playing this timeline.
final
- playLength → double
-
How long it runs for.
no setter
- progress → double
-
0–1 through the stretch being played.
no setter
- range ↔ (double, double)?
-
Play only this stretch of it, as
(from, to)in seconds — what a player's Play from and Play to ask for. Atoat or below zero means the end. Null plays all of it.getter/setter pair - rangeEnd → double
-
Where it ends.
no setter
- rangeStart → double
-
Where this playback starts.
no setter
-
runners
→ List<
TrackRunner> -
One per track, in the asset's order.
final
- runtimeType → Type
-
A representation of the runtime type of the object.
no setterinherited
- speed ↔ double
-
1 is as authored; negative plays backwards.
getter/setter pair
- time → double
-
Seconds from the start.
no setter
- world → World
-
The world the timeline plays in, where its bindings are looked up.
final
- wrap ↔ TimelineWrap?
-
Overrides the asset's wrap when set.
getter/setter pair
Methods
-
apply(
) → void - Makes the world look as the timeline says at time.
-
child(
TimelineAsset asset, Entity owner) → TimelinePlayback -
A playback of
assetinside this one, withowneras its "self". Its events come out of this timeline; its clock is the caller's to drive.override -
dispose(
) → void - Ends the playback for good: runners undo what only lasts while they run.
-
emit(
String name, [String payload = '']) → void -
Tells listeners
namehappened on the timeline.override -
endsAt(
double time) → bool -
True at the end of the play range (rangeEnd) unless the wrap is a
loop's, which goes straight on to the start: a
oncetimeline stops there and a ping-pong turns round.override -
fireBetween(
double from, double to) → void -
Fires what lies between
fromandtowithout moving the clock — for whoever drives this playback's time from outside, as a nested track does. -
loadTimeline(
String path) → Future< TimelineAsset> -
Reads another timeline, the way this one was read.
override
-
noSuchMethod(
Invocation invocation) → dynamic -
Invoked when a nonexistent method or property is accessed.
inherited
-
pause(
) → void - Stops the clock where it is; play carries on from there. Nothing is rewound or undone.
-
play(
{double? from}) → void -
Plays from
from, or from where it is — from the start when it had finished, or the end when speed runs backwards. -
playFrom(
String name) → bool -
Plays from the marker called
name; false when there is none. -
resolve(
TrackBinding binding, {bool includeInactive = false}) → Entity? -
The entity
bindingmeans right now, or null. Looked up once and kept until that entity goes away. An entity that is switched off counts only withincludeInactive.override -
seek(
double time) → void -
Jumps to
timeand shows it. Events in between do not fire — nor, called from an event handler, do the rest of that step's. A ping-pong sets off forwards from there. -
stop(
) → void - Stops and rewinds. What the timeline animated stays where it is.
-
toString(
) → String -
A string representation of this object.
inherited
-
update(
double deltaTime) → void -
Moves time on by
deltaTimeand shows the result. -
willWrite(
Component component, SchemaField field) → void -
A track is about to write
fieldofcomponentfor the first time this play. An editor previewing a timeline notes the value here, to put it back afterwards.override
Operators
-
operator ==(
Object other) → bool -
The equality operator.
inherited