Skip to content
English

Sequences

Pixling is preparing for Mac App Store release. Join the waitlist on pixling.app to hear when it launches.

A sequence is a finite, app-timed plan for one resident: motion-clip cuts paired with simultaneous movement, sizing, turns, lights, and temporary looks, plus actions, throws, repeats, and screen-edge state machines. You send the plan in one call, and Pixling keeps time. It plays once and stops; it is not autonomous. For when to use sequences and a short example, see Build expression.

Sequence run lifecycle
sequence.start ─┬─ dryRun: true ──▶ validated (does not run)
└─ run ──▶ accepted ──▶ preparing ──▶ running (⇄ paused)
│
┌──────────────────────┴────────────────────┐
▼ ▼
committing ──▶ completed cancelled / failed / expired

Call resident.describe with sections: ["sequence"] to inspect what a resident supports right now:

  • animations[]: id, name, motion, cycleMilliseconds, and frameCount. Pass id as a cut’s animation. motion holds the description the clip was generated from, when present. A cut’s from and to span 0..<frameCount.
  • palette: nearby source colors merged into at most 16 groups ({color, share, colors}, largest area first). Pass a group’s color to select.groups to light the whole group, or select.colors to light only that single color (see Light (glow)).
  • Capabilities and budgets: schemaVersion, maximumSteps, maximumExpandedSteps, maximumContentMilliseconds, maximumCutMilliseconds, and supportsGlow.
  • Current status: runningID (a run in progress, or null) and blockedBy (why a sequence cannot run now, or null).

Use resident sketch --animation ID to inspect a clip’s frames with matching frame numbers.

Minimal sequence.start call
{
"schemaVersion": 2,
"requestID": "wave-1",
"to": "No.7#1",
"steps": [
{"kind": "cut", "animation": "m2", "cycles": 2, "move": {"dx": 60, "dy": 0}},
{"kind": "cut", "holdMs": 600, "emote": [{"text": "♪"}]}
]
}
Key Value
schemaVersion 2 (required).
requestID Required; 1–96 characters from A–Z a–z 0–9 _ . : -.
to Exactly one placed resident; auto and everyone are refused.
steps or name Exactly one: an inline steps array, or the name of a sequence saved on this asset.
commit restore (default) or onSuccess.
dryRun true validates the plan without running it.

The entire request payload must be at most 64 KiB.

  • restore (default): after the final step, if the end differs from the start, the resident glides back in 250–400 ms (position, size, turn via the shorter arc, and opacity). It then immediately restores its temporary look and mirroring.
  • Glide exceptions: the glide does not count as a step or against the 30-second budget. Pixling skips the glide under Reduce Motion or when no path fits on the display; if no turning path fits, the turn restores at release instead (ending.turnAtRelease).
  • onSuccess: keeps and saves the final position, size, and turn. A resident with gravity falls first, then saves its landing position.
  • Grab or cancel: never glides; the resident stays where it is.

steps is an array of 1–32 objects, each identified by kind:

kind Keys
cut Cut keys grouped below.
action action: poke, settle, or pass.
throw vx, vy: velocity in pt/s (+x right, +y up), obeying gravity like resident.throw.
repeat times (1–16 or range) and steps (1–32 cut, action, throw, or choose; no nested repeat).
choose options: 2–8 bare steps (weight 1) or {weight?, steps} (weight 1–100, default 1).
state name, steps, on. A plan is either all states or no states.

A cut sets its duration with either animation or holdMs, except a drift cut, whose duration ends at a screen edge (or maxMs) and accepts animation optionally. All other cut keys are optional and run simultaneously during the cut.

Key Value
animation Clip ID from animations (at most 128 bytes).
from, to Inclusive 0-based start and end frames (defaults: 0 and last frame).
direction forward (default), reverse, or pingpong.
cycles 1–8 (default 1), or a range.
holdMs 1–10000 ms, or a range; holds the current frame without a clip.

from after to is refused; use direction: reverse to play backward.

Key Value
move {x, y} global footprint bottom-left (as resident.place), or {dx, dy} relative offset.
move.via 1–8 waypoints in the same coordinate keys; optional move.curve (catmullRom or bezier).
size Apparent longest side in points (> 0), matching resident.place size.
sizeAnchor Stationary point while resizing: bottom (default), center, or any corner.
turn Degrees from current angle, −1440 to 1440 (counter-clockwise positive; 360 is one full turn).
mirror true, false, "toggle" (flip facing), or "either" (random facing) from cut start.
easing Curve for move and size: smooth (default), linear, named easings, cubicBezier, or steps.
turnEasing Same forms as easing; defaults to the cut’s easing.
  • move and move.via: for {dx, dy}, +x is right, +y is up, and an omitted axis defaults to 0. Prefer dx/dy in saved sequences. move.curve defaults to catmullRom (passes through waypoints); bezier takes 1–2 control points that are not touched. Speed along the path is constant.
  • sizeAnchor: accepts bottom (feet stay put), center, bottomLeft, bottomRight, topLeft, or topRight. A dx/dy move (including via) moves that anchor; an absolute x/y move refuses any value other than bottom.
  • easing and turnEasing: named easings combine easeIn…, easeOut…, or easeInOut… with Sine, Quad, Cubic, Quart, Quint, Expo, Circ, Back, Elastic, or Bounce (for example, easeOutBack). Custom curves accept {"cubicBezier": [x1, y1, x2, y2]} (x in 0–1, |y| <= 4) or {"steps": n} (1–60). turnEasing: "linear" spins at constant speed.
Key Value
walk {direction?, speed, maxMs?}: walks at 10–400 pt/s until a screen edge or maxMs.
drift {vx?, vy?, reflect?, maxMs?}: glides at 10–1200 pt/s until a screen edge or maxMs.
climb true: rolls 90° onto the edge the previous walk met.
  • walk: loops animation at speed (10–400 pt/s) until hitting a screen edge or maxMs (100–30000). Stopping on maxMs fires done, not wall*. direction is forward (default: body’s right, or left when mirrored) or back. Requires animation, and cannot combine with move, size, turn, cycles, glow, opacity, or frame-timed emote/bounce.
  • drift: glides at constant 2D screen-space velocity (vx, vy) (hypot(vx, vy) 10–1200 pt/s; +x right, +y up; omitted axis defaults to 0) until a screen edge or maxMs (100–30000). animation is optional (omitting it glides on the current frame; holdMs is refused). Cannot combine with move, size, turn, cycles, glow, opacity, or frame-timed emote/bounce.
  • drift.reflect: reflect: true reflects the current drift velocity across the edge(s) hit (left/right flips vx, top/bottom flips vy, a corner flips both). If no drift has run yet, it uses this cut’s vx/vy as the initial velocity; if the previous drift stopped on maxMs, it continues unchanged.
  • climb: rotates 90° onto the edge the previous walk met, rolling into the corner at the walk’s speed at an even pace (looping the clip to fill it) so the feet land on that edge and forward runs along it. Valid only as the first step of a state entered exclusively by single-edge wall transitions (wall, wallLeft, wallRight, wallTop, wallBottom). Lights, emotes, and bounces fire only at its start.
Key Value
shake {amplitude, frequency?, decay?}: 0.5–64 pt, 1–30 Hz (default 12), decay default true.
opacity Target opacity (0–1) at cut end, shaped by easing; returns to 1 when the run ends.
glow 1–8 light steps with optional clip frame.
look Temporary resident.set appearance keys active from this cut until changed or run end.
say {text, author?, font?, size?}: emits a message at cut start.
bounce 1–8 {strength?, direction?, frame?} squash effects from resident.bounce.
emote 1–8 {text, count?, color?, palette?, frame?} head pops from resident.emote.
  • shake: deterministic across runs.
  • glow: each item is a light step (select, color, shape, direction, durationMs) plus optional frame, firing each time that clip frame shows. Without frame (and always in a holdMs cut), it fires at cut start.
  • look: accepts resident.set values for palette, cellStyle, tone, grain, block, shadow, sticker, reflection, reflectionDetail, outline, outlineWidth, reliefDetail, volumeDepth, volumeLight, volumeShadow, lightColor, seeThrough, motionTempo, motionFrameCount, and motionFrameOffset. Persists until another cut changes it and reverts when the run ends; saved settings are never modified.
  • say: follows message.send rules without keep or arrival signals. The card follows the body and remains after the run. Refused on wallpaper-pinned residents (wallpaperPinned).
  • bounce: matches resident.bounce, stacked at cut start or on each showing of clip frame (holdMs cuts reject frame). Silently skipped under Reduce Motion or while straddling two displays.
  • emote: matches resident.emote, firing at cut start or on each showing of clip frame (holdMs cuts reject frame). A newer emote replaces one still floating. Plays under Reduce Motion, is skipped without failing if the resident is unseen, and is refused on wallpaper-pinned residents (wallpaperPinned).

cycles, holdMs, walk.maxMs, drift.maxMs, and repeat.times also take a range {"min": a, "max": b} (both ends included). mirror: "either" faces a random way, and a walk follows the facing. A choose step plays one of its options drawn by weight; a repeat may hold a choose, and an option holds cut, action, and throw steps.

Pick a motion at random, play it 1–3 times facing either way, then rest 2–6 seconds, three to five times:

Fidget
{"steps": [
{"kind": "repeat", "times": {"min": 3, "max": 5}, "steps": [
{"kind": "choose", "options": [
{"weight": 3, "steps": [{"kind": "cut", "animation": "m2", "cycles": {"min": 1, "max": 3}, "mirror": "either"}]},
{"kind": "cut", "animation": "m3", "mirror": "either"}
]},
{"kind": "cut", "holdMs": {"min": 2000, "max": 6000}}
]}
]}
  • Options: an option is either {weight?, steps} or a single step written bare (weight 1), as m3 above. Pixling writes an option back bare whenever it has weight 1 and one step; refusals still name it options[1].steps[0].
  • No repeats in a row: {"kind": "choose", "avoidRepeat": true, ...} never draws the option it drew last at that place; the other options keep their weights. This holds within a run and across laps of everyday motion.
  • Random drift direction: a drift may take "angle" (degrees, 0 is right, counter-clockwise) and "speed" (10–1200 pt/s), each a number or a range, instead of vx/vy, for example {"angle": {"min": 0, "max": 360}, "speed": {"min": 80, "max": 160}}. Drawn values are multiples of 0.1, so drawn stays readable and pastes back exactly.
  • Draws: each run draws afresh from its requestID, and the same requestID always draws the same run. Calling dryRun with a requestID returns in drawn the exact steps start will play (Dry run). Every lap of everyday motion and every hook trigger draws anew.
  • Worst-case validation: both ends of every range and every option are checked before anything plays, so a draw never fails a run. A plan that only fits some draws is refused, naming the offending field:
    • Cut cap: each cut must fit 10 seconds at its maximum draw.
    • Start light: a light firing at a cut’s start must fit inside that cut’s shortest draw.
    • Plan cap: a plan without walks or drifts must fit 30 seconds at its longest draw (with each repeat at its max and each choose at its largest option).
  • Everyday motion: a sequence with ranges or choose can be pinned or marked occasional, drawing anew each lap. Picture-and-light sequences are usually flattened afresh each lap; others play like a moving sequence with a rest between laps. sequence.save reports which path applies in occasionalPlayback, and its length is not shown in advance.
  • Size: a plan writes out at most 128 steps, counting every option.

When every top-level step is a state, the plan acts as a finite state machine starting at the first state and unrolled from the resident’s starting position. Each state contains ordinary steps and up to 7 transitions in on:

Wall event fallback order
Two edges at once ──▶ wallCorner ──▶ wallLeft/Right/Top/Bottom ──▶ wall ──▶ stop step, continue state
Single edge ──▶ wallLeft / wallRight / wallTop / wallBottom ──▶ wall ──▶ stop step, continue state
event Fires when Without a transition
done All of the state’s steps finish. The run ends.
wallCorner A walk or drift hits both a horizontal and a vertical edge together. Falls back to the specific edge event, then wall.
wallLeft, wallRight, wallTop, wallBottom A walk or drift hits that specific edge. Falls back to wall.
wall A walk or drift reaches any edge (no more specific match); remaining steps are skipped. The step stops at the edge and the state continues.

A plan can hold at most 16 states, with one transition per event, and every to must name a state in the plan.

Bounce diagonally across all four walls like a DVD logo until the 30-second budget expires (or continuously when saved, pinned as idleAnimation: "sequence:<name>", and set to motionFeel: 0):

Bounce across all four walls
{"steps": [
{"kind": "state", "name": "dvd",
"steps": [{"kind": "cut", "drift": {"vx": 160, "vy": 110, "reflect": true}}],
"on": [{"event": "wall", "to": "dvd"}]}
]}

Walk to the edge, climb onto it, and keep circling the screen (to turn back instead, replace the second state’s steps with [{"kind": "cut", "animation": "m2", "mirror": "toggle"}]):

Walk and climb around the screen
{"steps": [
{"kind": "state", "name": "walk",
"steps": [{"kind": "cut", "animation": "m2", "walk": {"speed": 40}}],
"on": [{"event": "wall", "to": "climb"}]},
{"kind": "state", "name": "climb",
"steps": [{"kind": "cut", "animation": "m2", "climb": true}],
"on": [{"event": "done", "to": "walk"}]}
]}
  • Screen edges: edges match the visible area of the resident’s current display, respecting its gravity menu-bar and camera settings. A seam with another display counts as an edge, and walks and drifts never leave the display.
  • Termination: runs stop when the 30-second or 128-step budget runs out, or when a transition returns to a state with no elapsed time and no change in facing, rotation, drift velocity, or pending reflections. If nothing can play from the starting position, the call fails with invalidPlan.
  • Position-dependent counts: totalSteps, step indices, and nominalMs reflect the steps unrolled from the current position, so a dry run from another spot can differ.
  • Weighted branches: to also accepts 1–8 {"state": "…", "weight": 1–100} entries drawn by weight. The same requestID always draws the same branch; each lap of everyday motion draws fresh.
  • Gravity and climbing: residents with gravity do not climb; they turn around at the edge instead. Without gravity, restore turns back upright while onSuccess keeps the resident standing on the climbed edge. Grabbing ends the run and picks the body up upright.

Walks, drifts, climbs, and state machines can be marked occasional or pinned as usual motion when every walk and drift lives in a state whose wall transitions cover every edge it can hit.

  • Each lap ends in place (saved like onSuccess), and the next lap resumes from there.
  • When pinned with motionFeel: 0 (Always, outside Low Power Mode), walks, drifts, and cyclic state machines chain 30-second laps with no rest.
  • Chained laps carry their state, step, drift velocity, and temporary look across lap boundaries until the resident is touched or interrupted.
  • Step counts: up to 32 steps as submitted, 128 after repeat expansion. Step numbers in results count expanded steps (or unrolled steps for walks and states).
  • Durations: at most 30 seconds total and 10 seconds per cut. Any run still unfinished after 60 seconds terminates as expired.
  • Side-effect caps: at most 8 say, 32 emote, and 32 bounce per run after expansion.
  • Light rules: lights never overlap, fire at most three flashes per second (glowTooFrequent), and must finish inside their cut (glowOutsideCut).
  • Screen boundaries: paths may leave the screen or cross onto another display mid-run (like dragging by hand), and a move may finish off-screen. crossDisplayPathUnsupported is returned if a commit: onSuccess run would end outside every display, or if a throw step begins off every display or would leave its display under upward gravity.
  • Floor hopping: a floor-standing resident that would dip below the display bottom while turning automatically hops high enough and lands within the same cut (hoppedSteps) without changing cut length.
  • Concurrency and ownership: 1 run per resident (busy) and 4 active runs app-wide (capacityExceeded). busy also fires if another sequence.start on that resident is still validating; retry immediately. To coordinate multiple residents, send parallel sequence.start calls, which start within roughly one frame of each other. Residents bound to another client refuse writes (boundToAnotherClient).
  • Interaction with resident.status: status updates during a run do not interrupt it; the resident reverts to the latest status when the run ends. A status’s enter sequence uses the same admission rules and limits, is skipped (never queued) if blocked, and is stopped by an explicit sequence.start.

Clip frames, drifts, turns, shakes, actions, throws, and lights require motion and are refused when motion is unavailable:

Condition Refusal
The resident’s Motion is off motionOff
Motion is off for every resident appMotionOff
macOS Reduce Motion is on reduceMotion

Moves, size changes, and holds still run. Under Reduce Motion, they apply at the start of their cut while preserving its duration (reducedSteps lists those steps). Enabling Reduce Motion mid-run cancels the run with reduceMotion.

dryRun: true executes every validation check (resident, frames, final geometry, lights) without running or recording anything:

Dry run result
{"entityID":"…","state":"validated","totalSteps":2,"nominalMs":2400,"stepMs":[1200,1200],"ending":null,"hoppedSteps":[],
"drawn":[{"kind":"cut","animation":"m2","cycles":2,"mirror":true},{"kind":"cut","holdMs":1200}]}
  • nominalMs: planned duration excluding the glide back.
  • stepMs: duration of each expanded step after the cut’s motionTempo, useful for aligning lights or emotes. Inspect clip key frames (such as jump apexes) with resident.sketch.
  • hoppedSteps: 0-based expanded step indices of cuts that hop to clear the floor while turning.
  • drawn and drawnMs: the concrete steps drawn for this requestID in the same schema as steps (repeat opened, choose resolved, ranges and "either" replaced by drawn values). Pasting drawn back as steps plays the same run, and drawnMs gives each entry’s duration.
    • A walk or drift longer than 10 s is one entry in drawn but several 10 s pieces in stepMs.
    • A walk or drift already at its edge appears with drawnMs 0; it still turned the resident and set the drift.
    • A state machine returns "drawn": null with a drawnNote, because events pick each next state as it runs.
  • ending: null when end matches start; otherwise {distance, turnBack, scale, opacity, mirrored, lookChanged, returnMs, turnAtRelease}. distance is in points, turnBack is in −180 to 180°, scale is the size ratio, and returnMs is the glide duration or null when it does not glide.

sequence.start (without dryRun), sequence.get {runID, waitMs}, and sequence.cancel {runID} return the same receipt shape:

Run receipt
{"runID":"…","entityID":"…","requestID":"greeting-1","totalSteps":2,"state":"running","completedSteps":0,"stepIndex":0,"reducedSteps":[],"reason":null,"survivesRestart":false}
  • state: accepted, preparing, running, paused, committing, then terminal completed, cancelled, failed, or expired.
  • Waiting for completion: a start receipt confirms acceptance, not completion. Call sequence.get with waitMs (up to 55000) to wait until the run finishes or time runs out; omit waitMs for an immediate snapshot.
  • Progress fields: stepIndex is the currently executing expanded step (or null, including during the glide back). completedSteps counts finished expanded steps.
  • reason: explains non-completed endings: cancelled, userInteraction (touching the resident always wins), lifecycle (sleep, lock, or display off), displayChanged, stateChanged, targetRemoved, reduceMotion, expired, executionFailed, or commitFailed.
  • Idempotent cancel: canceling an already ended run returns its receipt unchanged.
  • App-owned execution: runs continue if the HTTP connection closes, and get returns promptly without holding a stream open. Runs do not survive an app restart. get and cancel only see your own active runs and your most recent ended run per resident; any other runID (including another caller’s) returns notFound.
  • requestID retries: resending the same requestID with identical content while the run is active returns the same receipt. Different content fails with requestConflict naming the active runID in reason. After the run finishes, reusing requestID starts a fresh run (see Effects and retries).

Saved sequences belong to an asset rather than an individual copy, so to accepts any selector identifying the asset (No.7 does not need to be on the desk).

Save an occasional sequence (pixling_sequence_save)
{
"to": "No.7",
"name": "fidget",
"occasional": true,
"steps": [
{"kind": "cut", "animation": "m2", "cycles": {"min": 1, "max": 2}, "mirror": "either"},
{"kind": "cut", "holdMs": {"min": 1000, "max": 2500}}
]
}
  • sequence.save {to, name, steps, occasional?}: saves steps without a target, requestID, or commit. Names are 1–64 UTF-8 bytes without leading or trailing spaces or control characters. Reusing a name replaces it in place. Limit: 32 saved sequences per asset (capacityExceeded). Steps validate against the asset’s clips at save time.
  • sequence.list {to, name?}: returns all saved sequences for the asset, or only name (sequenceNotFound if absent).
  • sequence.delete {to, name}: removes one saved sequence (sequenceNotFound if absent).

Pass occasional: true to mix the sequence into everyday motion for that asset’s residents, false to remove it, or omit it to keep the existing setting (CLI: --occasional / --no-occasional). Set occasional: true only when the user asks.

  • Sequences containing say, emote, bounce, or throw cannot be marked occasional (invalidPlan, path occasional).
  • Residents pinned to one motion, residents with no rest between cycles, and smooth (non-pixel) residents do not rotate.
  • A moving occasional sequence plays at most once every 3 minutes per resident and yields to any explicit request.

save returns only what it saved:

Save result
{"asset":"pack/hero","name":"fidget","occasional":true,"replaced":false,"count":3,"remaining":29,
"occasionalPlayback":{"path":"runner","reason":"two waits in a row at steps[2]"}}

count and remaining are this asset’s saved sequences and what is left of 32. On marked sequences, occasionalPlayback reports how everyday motion plays it, with reason naming the first thing that kept it off the lighter paths (such as steps[1] moves the body):

occasionalPlayback.path How everyday motion plays it
drawnPerLap Picture-only with ranges or choose: drawn and flattened afresh each lap.
loop Picture-only and fixed: one flattened loop.
runner Played like a run, at most once every 3 minutes per resident.

list and delete return {asset, sequences: [{name, steps, occasional?, occasionalPlayback?}]} in saved order (occasional: true and occasionalPlayback appear only on marked entries); delete returns the list that remains.

Play a saved sequence with sequence.start {…, "name": "…"}. Pixling revalidates it against what the resident currently shows; a missing clip fails with animationUnknown. Saved sequences also appear in the Sequences section of the asset’s Field Guide page in Pixling Studio, where the user can play and edit them.

Sequence refusals return rejected with structured diagnostic fields:

Field Value
error.detail The refusal code word.
error.path Location using expanded step indices (for example, steps[2].to).
error.reason One sentence naming the offending value.
error.hint Actionable fix.

When argument decoding rejects a request before it reaches the app, the same location and reason come back as invalidArguments with field and problem.

Category Codes
Plan structure invalidPlan, invalidRequestID, unsupportedAction
Assets and looks animationUnknown, unsupportedRepresentation, lookUnavailable, sequenceNotFound
Timing and budgets durationExceeded, capacityExceeded
Motion and physics invalidGeometry, crossDisplayPathUnsupported, throwDisabled, motionOff, appMotionOff, reduceMotion
Light (glow) glowTooFrequent, glowOutsideCut
Target and visibility singularTargetRequired, targetNotFound, notVisible, hidden, wallpaperPinned
State and ownership boundToAnotherClient, busy, lifecycle, unavailable, resourceDenied, requestConflict, notFound
Command Operation
sequence start --to SELECTOR (--steps JSON|@file.json | --name NAME) [--commit restore|onSuccess] [--request-id KEY] [--dry-run] [--wait] sequence.start
sequence get --run RUN_ID [--wait-ms MS] sequence.get
sequence cancel --run RUN_ID sequence.cancel
sequence save --to SELECTOR --name NAME --steps JSON|@file.json [--occasional|--no-occasional] sequence.save
sequence list --to SELECTOR [--name NAME] sequence.list
sequence delete --to SELECTOR --name NAME sequence.delete
  • steps uses the same JSON schema documented above. See CLI for --help and refusal formatting.
  • Without --request-id, each invocation generates a fresh key, so re-running starts a new run.
  • --dry-run prints ok: N steps, about S s (nothing ran), followed by ends: … when end differs from start (for example ends: 110pt from home, turned 180°, look differs — glides back in 0.4 s), hops off the floor to turn: step N (1-based), and drawn: […] as one line of JSON.
  • --wait waits via sequence.get (waitMs) and prints the terminal state. If the run can no longer be read (because a later run on that resident ended or the app restarted), it reports that and exits 0 without claiming success or failure.