Sprite
A ::sprite shows one pose of a character: a row of its sprite sheet, played frame by frame.
The sheet comes from the character's bible (::sheet{src layout}, see the scenario docs), so a
story names the character and the pose, never a file. In v1 it plays in the motion format (a film
shot) and in the webstory format (a card, a still).
Syntax
character.story.md
In a film, --- type= is the same shot written with the scene
attributes of the bible. A scene that holds one ::sprite is a sprite, without type=; the
paragraph under it is its caption.
| Attribute | Role |
|---|---|
character | id of a character of the bible named by cast:, which has a sheet |
pose | a row of the layout (default idle) |
loop | loop or once; default, the playback of the row |
frame | a fixed frame of the pose, from 0 (a still) |
alt | what the image shows, read by screen readers; a warning when missing, an error with recit validate -- |
src | the sheet itself, instead of character (a path or a URL) |
layout | the layout of src (default codex-pet-v1) |
The layout
codex-pet-v1 is the sheet of the hatch-pet skill: 1536×1872 pixels, cells of 192×208, eight
columns on nine rows, one pose per row.
| Pose | Frames | Playback |
|---|---|---|
idle | 6 | loop |
running- | 8 | loop |
running-left | 8 | loop |
waving | 4 | once |
jumping | 5 | once |
failed | 8 | once |
waiting | 6 | loop |
running | 6 | loop |
review | 6 | loop |
A pose missing from the layout, a character without a sheet and a story without cast: are errors
with their line. A film stays on screen for two plays of a looping pose and one play of a once
pose (the last frame is then held).
Rendering
The frame is a pure function of the time: the cumulative durations of the row give the frame, and an
SVG shows its cell through its view box over the whole sheet. No decoding and no canvas, so the web
player, the MP4 and a PNG show the same image. Under prefers-, and in a story card
or a PNG, the sprite is frame 0 of its pose. The sheet is scaled smoothly: a sheet is a rendered
picture, not pixel art.
recit inlines the sheet of the bible as a data: URI, so a film or a card needs no file to serve.
For a synthetic sheet to try things with, recit pixel sheet draws one from a seed;
examples/ is a Lorem character in its nine poses.
React