Skip to content

anim-format (runtime format) / ClipClock

Class: ClipClock ​

a timeline a chain can drive

Implements ​

Constructors ​

Constructor ​

ts
new ClipClock(
   host, 
   round, 
   fps, 
   opts?
): ClipClock;

Parameters ​

ParameterType
hostClipClockHost
roundClockRound
fpsnumber
opts?ClipClockOptions

Returns ​

ClipClock

Properties ​

PropertyModifierTypeDefault valueDescription
accpublicnumber0ms toward the next beat
afterGotopublic| { then?: "play" | "stop"; to: number; token: number; } | nullnulla gotoAfter waiting for the playhead to leave its frame; token = moves when it was set (any other move voids it)
backwardpublicbooleanfalse-
controlledpublicbooleanfalsea synced clip an action took over: its own clock from then on
directionpublic-1 | 11-
drivenpublicbooleanfalsefollows its parent's frames (synced)
fpspublicnumberundefinedauthored frames per second
fracpublicnumber0fractional playhead: position − frame shown (a speed that is not whole)
framepublicnumber0the frame shown
globalFpspublicClockRamp | nullnull-
hostreadonlyClipClockHostundefined-
linearreadonlybooleanundefined-
looppublicbooleantrueback to the first frame at the end
movespublicnumber0playback chains: bumped by every move an action makes
ownFpspublicClockRamp | nullnull-
playingpublicbooleantrue-
repeatsreadonlyMap<number, number>...repeat counters per frame of the list
roundreadonlyClockRoundundefined-
speedpublicnumber1beats move the playhead this far
stopAtpublicnumber | nullnulla playTo's frame
waitMspublicnumber0-

Accessors ​

currentFps ​

Get Signature ​

ts
get currentFps(): number;

frames per second now: own speed, else the root's global one, else fps

Returns ​

number


position ​

Get Signature ​

ts
get position(): number;

the playhead position (the frame shown ± a fraction)

Returns ​

number

Methods ​

awaitMove() ​

ts
awaitMove(token, cont): void;

cont once the playTo / wait that left moves at token is done and nothing moved the playhead since (else never)

Parameters ​

ParameterType
tokennumber
cont() => void

Returns ​

void

Implementation of ​

ChainClip.awaitMove


chainStep() ​

ts
chainStep(a, scene): ChainStep;

one action of a script chain on this clip, as a round of its own

Parameters ​

ParameterType
aPlaybackAction
scenestring | undefined

Returns ​

ChainStep


dropChain() ​

ts
dropChain(): void;

the clip is gone: a waiting chain never goes on

Returns ​

void


enter() ​

ts
enter(
   f, 
   actions?, 
   beat?
): void;

the playhead moves to f (actions = its frame actions run; beat = the clock moved it)

Parameters ​

ParameterTypeDefault value
fnumberundefined
actions?booleantrue
beat?booleanfalse

Returns ​

void


jumpTo() ​

ts
jumpTo(
   f, 
   then?, 
   repeat?
): ChainStep;

a gotoNow: to f (its actions run), playing or stopped per then; a frame already visited in this round = a loop: the jump is void

Parameters ​

ParameterTypeDefault value
fnumberundefined
then?"play" | "stop"undefined
repeat?booleanfalse

Returns ​

ChainStep


play() ​

ts
play(): void;

Returns ​

void


resetFps() ​

ts
resetFps(seconds?): void;

back to the global speed, over seconds

Parameters ​

ParameterTypeDefault value
seconds?number0

Returns ​

void


resetGlobalFps() ​

ts
resetGlobalFps(seconds?): void;

the global speed back to the authored fps, over seconds

Parameters ​

ParameterTypeDefault value
seconds?number0

Returns ​

void


runActions() ​

ts
runActions(
   actions, 
   f?, 
   external?
): void;

Runs playback actions as a CHAIN (runChain, owner 2026-11-05): in order, a playTo / wait holding the rest until it is done, the rest dropped when something else moves that playhead first. f = the frame the list sits on. external = not this clip's own frame actions (a click, a sound's onEnd, the host): then, like actions aimed at another clip, a synced clip they move takes its own clock.

Parameters ​

ParameterTypeDefault value
actionsreadonly PlaybackAction[]undefined
f?number...
external?booleantrue

Returns ​

void


sceneIndex() ​

ts
sceneIndex(): number;

Returns ​

number


setFps() ​

ts
setFps(fps, seconds?): void;

this clip's own speed, reached over seconds (0 = at once)

Parameters ​

ParameterTypeDefault value
fpsnumberundefined
seconds?number0

Returns ​

void


setGlobalFps() ​

ts
setGlobalFps(fps, seconds?): void;

every clip's speed (those without their own), over seconds

Parameters ​

ParameterTypeDefault value
fpsnumberundefined
seconds?number0

Returns ​

void


showAt() ​

ts
showAt(f): void;

stops on frame f (a script's fractional goto / showSection: the host puts the fraction back); its actions run only when the frame changes

Parameters ​

ParameterType
fnumber

Returns ​

void


startPlayTo() ​

ts
startPlayTo(f): ChainStep;

plays forward or backward to f and stops there (no wrap; frames passed run no actions); blocks a chain until it arrives

Parameters ​

ParameterType
fnumber

Returns ​

ChainStep


stop() ​

ts
stop(): void;

Returns ​

void


stopAll() ​

ts
stopAll(): void;

this clip and every own-clock clip nested in it stop (synced ones follow)

Returns ​

void


takeControl() ​

ts
takeControl(): void;

a synced clip an action moves keeps its own clock from now on

Returns ​

void


update() ​

ts
update(ms): object;

Advances time by ms: ramps, waits, a waiting chain, then the beats (each moves the playhead by speed; the frame shown is the position rounded half up and is entered when it changes — owner 2026-11-06). Returns the beats that moved the playhead and the frame time used.

Parameters ​

ParameterType
msnumber

Returns ​

object

NameType
beatsnumber
frameMsnumber

HereSplash — 2D animation for the web