Skip to content

1681-engine / index / TimelineBuilder

Abstract Class: TimelineBuilder ​

Defined in: src/core/TimelineBuilder.ts:21

The building half of Timeline: where each tween, call, gap and nested timeline goes. Kept apart from the playing half so each stays readable; nothing here runs per frame.

Extended by ​

Constructors ​

Constructor ​

ts
new TimelineBuilder(): TimelineBuilder;

Returns ​

TimelineBuilder

Properties ​

children ​

ts
protected readonly children: TimelineChild[] = [];

Defined in: src/core/TimelineBuilder.ts:23

Sorted by start; equal starts keep the order they were added in.


labels ​

ts
protected readonly labels: Map<string, number>;

Defined in: src/core/TimelineBuilder.ts:24

Accessors ​

duration ​

Get Signature ​

ts
get duration(): number;

Defined in: src/core/TimelineBuilder.ts:35

One play, ms (the longest child's end).

Returns ​

number

Methods ​

add() ​

ts
add(child, at?): this;

Defined in: src/core/TimelineBuilder.ts:103

Plays another timeline (built, not repeating forever) as one child of this one; it is no longer stepped alone.

Parameters ​

ParameterType
childTimelineBuilder
at?TimelinePosition

Returns ​

this


adopt() ​

ts
abstract protected adopt(child): NestedPlay;

Defined in: src/core/TimelineBuilder.ts:32

Checks child may be played by this timeline and takes it over (it stops being stepped alone).

Parameters ​

ParameterType
childTimelineBuilder

Returns ​

NestedPlay


call() ​

ts
call(fn, at?): this;

Defined in: src/core/TimelineBuilder.ts:62

Calls fn when the playhead passes at (default: the end so far), going either way.

Parameters ​

ParameterType
fn() => void
at?TimelinePosition

Returns ​

this


label() ​

ts
label(name, at?): this;

Defined in: src/core/TimelineBuilder.ts:72

Names a point (default: the end so far), for positions and seek.

Parameters ​

ParameterType
namestring
at?TimelinePosition

Returns ​

this


labelTime() ​

ts
labelTime(name): number | undefined;

Defined in: src/core/TimelineBuilder.ts:78

Where a label stands, if it is set.

Parameters ​

ParameterType
namestring

Returns ​

number | undefined


parallel() ​

ts
parallel(build, at?): this;

Defined in: src/core/TimelineBuilder.ts:86

Everything build adds starts together, at at (default: the end so far); a position inside is measured from the group's start. What follows the group starts at its longest child's end.

Parameters ​

ParameterType
build(timeline) => void
at?TimelinePosition

Returns ​

this


to() ​

ts
to(
   targets, 
   props, 
   options?
): this;

Defined in: src/core/TimelineBuilder.ts:40

Tweens the numeric props of targets (one object or several), after what came before unless at says.

Parameters ​

ParameterType
targetsobject | readonly object[]
propsTimelineProps
optionsTimelineTweenOptions

Returns ​

this


wait() ​

ts
wait(ms): this;

Defined in: src/core/TimelineBuilder.ts:67

ms of nothing: the next child starts that much later, and a wait at the end makes the timeline longer.

Parameters ​

ParameterType
msnumber

Returns ​

this

Released under the MIT License.