Skip to main content

Class: MasterTimeline

Defined in: src/animation/MasterTimeline.ts:64

Extends​

Constructors​

Constructor​

new MasterTimeline(): MasterTimeline

Returns​

MasterTimeline

Inherited from​

Timeline.constructor

Properties​

_currentTime​

protected _currentTime: number = 0

Defined in: src/animation/Timeline.ts:33

Current playback time

Inherited from​

Timeline._currentTime


_startedAnimations​

protected _startedAnimations: Set<Animation<Mobject>>

Defined in: src/animation/Timeline.ts:39

Track which animations have been started

Inherited from​

Timeline._startedAnimations

Accessors​

length​

Get Signature​

get length(): number

Defined in: src/animation/Timeline.ts:243

Get the number of animations in the timeline.

Returns​

number

Inherited from​

Timeline.length


segmentCount​

Get Signature​

get segmentCount(): number

Defined in: src/animation/MasterTimeline.ts:463

Get the segment count.

Returns​

number


slideCount​

Get Signature​

get slideCount(): number

Defined in: src/animation/MasterTimeline.ts:394

Number of slides built by finalizeSlides().

Returns​

number

Methods​

add()​

add(animation, position): this

Defined in: src/animation/Timeline.ts:46

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: src/animation/Timeline.ts:66

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

Parameters​

animations​

Animation<Mobject>[]

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: src/animation/MasterTimeline.ts:185

Add a segment containing one or more parallel animations.

Parameters​

animations​

Animation<Mobject>[]

Returns​

Segment


addWaitSegment()​

addWaitSegment(duration): Segment

Defined in: src/animation/MasterTimeline.ts:229

Add a wait (pause) segment with no animations.

Parameters​

duration​

number

Returns​

Segment


beginSlide()​

beginSlide(opts): void

Defined in: src/animation/MasterTimeline.ts:261

Record a slide boundary: the next segment added will start a new slide with the given options. Inspired by manim-slides' next_slide(...) — the options configure the slide that follows this call.

If no boundary is ever recorded, every segment becomes its own slide (per-play behavior, used by existing slidesMode callers).

Calling beginSlide() twice at the same segment index (i.e. with no intervening play/wait) drops the earlier call's options, since an empty slide cannot carry options into anything that will play. We warn to surface the likely user error.

Parameters​

opts​

SlideOptions = {}

Returns​

void


clear()​

clear(): this

Defined in: src/animation/Timeline.ts:250

Clear all animations from the timeline.

Returns​

this

Inherited from​

Timeline.clear


finalizeSlides()​

finalizeSlides(): void

Defined in: src/animation/MasterTimeline.ts:296

Build the _slides array from recorded segments and slide boundaries. Call once after the recording builder finishes; idempotent — calling twice with the same _segments / _slideBoundaries produces the same _slides.

  • No boundaries recorded: each segment is its own slide.
  • Otherwise: segments before the first boundary form an implicit slide 0 with default opts; each boundary opens a new slide with its opts that captures all subsequent segments up to the next boundary (or the end).

Empty slides (consecutive boundaries with no plays between them) are skipped — they have no animations and no duration to occupy.

Throws if any slide carries loop: true but has zero total duration, since the player would rewind every frame.

Returns​

void


getCurrentSegment()​

getCurrentSegment(): Segment

Defined in: src/animation/MasterTimeline.ts:413

Get the currently-active segment based on _currentTime.

Returns​

Segment


getCurrentSlide()​

getCurrentSlide(): Slide

Defined in: src/animation/MasterTimeline.ts:389

Get the currently-active slide based on _currentTime.

Returns​

Slide


getCurrentTime()​

getCurrentTime(): number

Defined in: src/animation/Timeline.ts:236

Get the current playback time.

Returns​

number

Inherited from​

Timeline.getCurrentTime


getDuration()​

getDuration(): number

Defined in: src/animation/Timeline.ts:229

Get the total duration of the timeline.

Returns​

number

Inherited from​

Timeline.getDuration


getSegmentAtTime()​

getSegmentAtTime(time): Segment

Defined in: src/animation/MasterTimeline.ts:401

Get the segment at the given time.

Parameters​

time​

number

Returns​

Segment


getSegments()​

getSegments(): readonly Segment[]

Defined in: src/animation/MasterTimeline.ts:362

Get all segments.

Returns​

readonly Segment[]


getSlideAtTime()​

getSlideAtTime(time): Slide

Defined in: src/animation/MasterTimeline.ts:377

Get the slide active at the given time. Returns null if time is before the first slide's startTime or no slides exist.

Parameters​

time​

number

Returns​

Slide


getSlides()​

getSlides(): readonly Slide[]

Defined in: src/animation/MasterTimeline.ts:369

Get all slides.

Returns​

readonly Slide[]


isFinished()​

isFinished(): boolean

Defined in: src/animation/Timeline.ts:215

Check if the timeline has finished playing.

Returns​

boolean

Inherited from​

Timeline.isFinished


isPlaying()​

isPlaying(): boolean

Defined in: src/animation/Timeline.ts:222

Check if the timeline is currently playing.

Returns​

boolean

Inherited from​

Timeline.isPlaying


nextSegment()​

nextSegment(): Segment

Defined in: src/animation/MasterTimeline.ts:421

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: src/animation/Timeline.ts:192

Pause the timeline.

Returns​

this

Inherited from​

Timeline.pause


play()​

play(): this

Defined in: src/animation/Timeline.ts:184

Start playing the timeline.

Returns​

this

Inherited from​

Timeline.play


prevSegment()​

prevSegment(): Segment

Defined in: src/animation/MasterTimeline.ts:438

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: src/animation/MasterTimeline.ts:176

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

Returns​

this

Overrides​

Timeline.reset


seek()​

seek(time): this

Defined in: src/animation/MasterTimeline.ts:91

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: src/animation/MasterTimeline.ts:143

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