Class: MasterTimeline
Defined in: animation/MasterTimeline.ts:62
Extends
Constructors
Constructor
new MasterTimeline():
MasterTimeline
Returns
MasterTimeline
Inherited from
Properties
_startedAnimations
protected_startedAnimations:Set<Animation>
Defined in: animation/Timeline.ts:38
Track which animations have been started
Inherited from
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
segmentCount
Get Signature
get segmentCount():
number
Defined in: animation/MasterTimeline.ts:436
Get the segment count.
Returns
number
slideCount
Get Signature
get slideCount():
number
Defined in: animation/MasterTimeline.ts:367
Number of slides built by finalizeSlides().
Returns
number
Methods
add()
add(
animation,position):this
Defined in: animation/Timeline.ts:45
Add an animation to the timeline.
Parameters
animation
The animation to add
position
PositionParam = '>'
When to start the animation (default: '>' - after previous ends)
Returns
this
Inherited from
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
The animations to add
position
PositionParam = '>'
When to start all animations (default: '>' - after previous ends)
Returns
this
Inherited from
addSegment()
addSegment(
animations):Segment
Defined in: animation/MasterTimeline.ts:172
Add a segment containing one or more parallel animations.
Parameters
animations
Returns
addWaitSegment()
addWaitSegment(
duration):Segment
Defined in: animation/MasterTimeline.ts:202
Add a wait (pause) segment with no animations.
Parameters
duration
number
Returns
beginSlide()
beginSlide(
opts):void
Defined in: animation/MasterTimeline.ts:234
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: animation/Timeline.ts:249
Clear all animations from the timeline.
Returns
this
Inherited from
finalizeSlides()
finalizeSlides():
void
Defined in: animation/MasterTimeline.ts:269
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: animation/MasterTimeline.ts:386
Get the currently-active segment based on _currentTime.
Returns
getCurrentSlide()
getCurrentSlide():
Slide
Defined in: animation/MasterTimeline.ts:362
Get the currently-active slide based on _currentTime.
Returns
getCurrentTime()
getCurrentTime():
number
Defined in: animation/Timeline.ts:235
Get the current playback time.
Returns
number
Inherited from
getDuration()
getDuration():
number
Defined in: animation/Timeline.ts:228
Get the total duration of the timeline.
Returns
number
Inherited from
getSegmentAtTime()
getSegmentAtTime(
time):Segment
Defined in: animation/MasterTimeline.ts:374
Get the segment at the given time.
Parameters
time
number
Returns
getSegments()
getSegments(): readonly
Segment[]
Defined in: animation/MasterTimeline.ts:335
Get all segments.
Returns
readonly Segment[]
getSlideAtTime()
getSlideAtTime(
time):Slide
Defined in: animation/MasterTimeline.ts:350
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
getSlides()
getSlides(): readonly
Slide[]
Defined in: animation/MasterTimeline.ts:342
Get all slides.
Returns
readonly Slide[]
isFinished()
isFinished():
boolean
Defined in: animation/Timeline.ts:214
Check if the timeline has finished playing.
Returns
boolean
Inherited from
isPlaying()
isPlaying():
boolean
Defined in: animation/Timeline.ts:221
Check if the timeline is currently playing.
Returns
boolean
Inherited from
nextSegment()
nextSegment():
Segment
Defined in: animation/MasterTimeline.ts:394
Seek to the start of the next segment. Returns the segment seeked to, or null if already at the end.
Returns
pause()
pause():
this
Defined in: animation/Timeline.ts:191
Pause the timeline.
Returns
this
Inherited from
play()
play():
this
Defined in: animation/Timeline.ts:183
Start playing the timeline.
Returns
this
Inherited from
prevSegment()
prevSegment():
Segment
Defined in: animation/MasterTimeline.ts:411
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
reset()
reset():
this
Defined in: animation/MasterTimeline.ts:163
Override reset to use seek(0) so future mobjects are hidden.
Returns
this
Overrides
seek()
seek(
time):this
Defined in: animation/MasterTimeline.ts:89
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
update()
update(
dt):void
Defined in: animation/MasterTimeline.ts:130
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