Skip to main content

Class: MasterTimeline

Defined in: animation/MasterTimeline.ts:23

Extends

Constructors

Constructor

new MasterTimeline(): MasterTimeline

Returns

MasterTimeline

Inherited from

Timeline.constructor

Properties

_startedAnimations

protected _startedAnimations: Set<Animation>

Defined in: animation/Timeline.ts:38

Track which animations have been started

Inherited from

Timeline._startedAnimations

Accessors

length

Get Signature

get length(): number

Defined in: animation/Timeline.ts:242

Get the number of animations in the timeline.

Returns

number

Inherited from

Timeline.length


segmentCount

Get Signature

get segmentCount(): number

Defined in: animation/MasterTimeline.ts:248

Get the segment count.

Returns

number

Methods

add()

add(animation, position): this

Defined in: animation/Timeline.ts:45

Add an animation to the timeline.

Parameters

animation

Animation

The animation to add

position

PositionParam = '>'

When to start the animation (default: '>' - after previous ends)

Returns

this

Inherited from

Timeline.add


addParallel()

addParallel(animations, position): this

Defined in: animation/Timeline.ts:65

Add multiple animations to play in parallel (all start at the same time).

Parameters

animations

Animation[]

The animations to add

position

PositionParam = '>'

When to start all animations (default: '>' - after previous ends)

Returns

this

Inherited from

Timeline.addParallel


addSegment()

addSegment(animations): Segment

Defined in: animation/MasterTimeline.ts:127

Add a segment containing one or more parallel animations. Returns the segment's start time (for the recorder to resolve).

Parameters

animations

Animation[]

Returns

Segment


addWaitSegment()

addWaitSegment(duration): Segment

Defined in: animation/MasterTimeline.ts:157

Add a wait (pause) segment with no animations.

Parameters

duration

number

Returns

Segment


clear()

clear(): this

Defined in: animation/Timeline.ts:249

Clear all animations from the timeline.

Returns

this

Inherited from

Timeline.clear


getCurrentSegment()

getCurrentSegment(): Segment

Defined in: animation/MasterTimeline.ts:198

Get the currently-active segment based on _currentTime.

Returns

Segment


getCurrentTime()

getCurrentTime(): number

Defined in: animation/Timeline.ts:235

Get the current playback time.

Returns

number

Inherited from

Timeline.getCurrentTime


getDuration()

getDuration(): number

Defined in: animation/Timeline.ts:228

Get the total duration of the timeline.

Returns

number

Inherited from

Timeline.getDuration


getSegmentAtTime()

getSegmentAtTime(time): Segment

Defined in: animation/MasterTimeline.ts:186

Get the segment at the given time.

Parameters

time

number

Returns

Segment


getSegments()

getSegments(): readonly Segment[]

Defined in: animation/MasterTimeline.ts:179

Get all segments.

Returns

readonly Segment[]


isFinished()

isFinished(): boolean

Defined in: animation/Timeline.ts:214

Check if the timeline has finished playing.

Returns

boolean

Inherited from

Timeline.isFinished


isPlaying()

isPlaying(): boolean

Defined in: animation/Timeline.ts:221

Check if the timeline is currently playing.

Returns

boolean

Inherited from

Timeline.isPlaying


nextSegment()

nextSegment(): Segment

Defined in: animation/MasterTimeline.ts:206

Seek to the start of the next segment. Returns the segment seeked to, or null if already at the end.

Returns

Segment


pause()

pause(): this

Defined in: animation/Timeline.ts:191

Pause the timeline.

Returns

this

Inherited from

Timeline.pause


play()

play(): this

Defined in: animation/Timeline.ts:183

Start playing the timeline.

Returns

this

Inherited from

Timeline.play


prevSegment()

prevSegment(): Segment

Defined in: animation/MasterTimeline.ts:223

Seek to the start of the previous segment (or beginning of current). If we're more than 0.5s into the current segment, seeks to its start. Otherwise seeks to the previous segment's start.

Returns

Segment


reset()

reset(): this

Defined in: animation/MasterTimeline.ts:117

Override reset to use seek(0) so future mobjects are hidden.

Returns

this

Overrides

Timeline.reset


seek()

seek(time): this

Defined in: animation/MasterTimeline.ts:43

Override seek to always reset ALL animations before re-applying. The base Timeline only resets future animations on backward seek, which leaves already-finished animations in their final state (e.g. a FadeOut'd mobject stays invisible when scrubbing back).

Parameters

time

number

Returns

this

Overrides

Timeline.seek


update()

update(dt): void

Defined in: animation/MasterTimeline.ts:84

Override update to restore opacity for mobjects whose introducing segment starts during this tick. seek() hides future mobjects by setting opacity=0; this restores them exactly when playback crosses their segment boundary (not every frame).

Parameters

dt

number

Returns

void

Overrides

Timeline.update