Skip to content

PlayerState

Copy as Markdown

PlayerState = readonly [name: string, firstEnd: number | null, endless: 0 | 1, chain: readonly (readonly [state: string, start: number])[], length: number | null] | readonly [name: string, firstEnd: number | null, endless: 0 | 1, chain: readonly (readonly [state: string, start: number])[], length: number | null, loop: PlayerLoop]

One state of the table: [name, firstEnd, endless, chain, length, loop?].

  • name: what data-rupa-state and player.play(name) call it.
  • firstEnd: the end of the chain’s first clip, in ms since the state began; null when that clip has no end. A trigger’s release runs the state back only while it is in that clip.
  • endless: 1 when that first clip repeats forever: a release jumps back at once instead of running back.
  • chain: each clip of the chain, [state, start] (its start in ms since the state began).
  • length: the chain’s length in ms; null without an end (an endless clip, or a loop back).
  • loop: where the chain goes on when it leads back to one of its clips (PlayerLoop), when it does.