Skip to content

PlayerData

Copy as Markdown

The table of a flow: its states, triggers and poses, as the export writes it (into the snippet, into <base>.player.json, into a .rupaplay file). The keys are short because the table is pasted into every snippet. mount checks a table it is given and leaves out a part that fails.

// A card that runs a 300 ms "hover" state while the pointer is over it, and runs it back when it leaves.
const data: PlayerData = {
v: 1,
r: "card",
e: "idle",
w: 0,
m: 0,
s: [
["idle", null, 1, [["idle", 0]], null],
["hover", 300, 0, [["hover", 0]], 300],
],
t: [["hover", ".card", "hover", 1]],
p: [],
};

readonly e: string | null

The state of the default chain, which plays while data-rupa-state names none; null without one.


readonly m: 0 | 1

1 when the export writes the reduced motion block: under prefers-reduced-motion no SMIL animation begins.


readonly p: readonly PlayerPose[]

The poses a state starts from (PlayerPose).


readonly r: string

The root’s class (the export’s prefix): the root is the element with this class and data-rupa.


readonly s: readonly PlayerState[]

The states (PlayerState).


readonly t: readonly PlayerTrigger[]

The triggers (PlayerTrigger).


readonly v: 1

The format’s version, 1: raised only when the format changes.


readonly w: 0 | 1

1 when the default chain waits for the root to enter the viewport before it starts.