Sinua
Reference

FX Spec

The design file format — one JSON file that describes a visual, its lifecycle states, bindings and performance rules, and renders identically on every platform.

An FX Spec is a small JSON file that describes a visual completely: the object and pattern, colour, materials, lifecycle states, data bindings and low-power rules. Every platform resolves it with the same engine, so one file renders the same on the web, iOS, Android and React Native. Designers can hand it over, and apps can ship it, load it from a server, or build it in code.

voice-orb.fxspec.json
{
  "fxSpec": "1.8",
  "name": "Voice orb",
  "description": "One shape for the whole conversation: the pattern stays `glowing` and the agent's state changes how it behaves -- speed, density, glow, `ink` and which voice drives it.",
  "object": "orb",
  "pattern": "glowing",
  "size": 64,
  "ink": 1,
  "color": {
    "value": "#6E56CF",
    "mix": 0.92
  },
  "params": {
    "hueSpread": 30,
    "hueSpeed": 0,
    "surfaceScale": 1.2,
    "surfaceSpeed": 0.1,
    "nodeCount": 220,
    "nodeSize": 1.15,
    "saturation": 0.5
  },
  "materials": {
    "glow": {
      "strength": 0.25,
      "radius": 3
    }
  },
  "bindings": {
    "muted": {
      "input": "micMuted"
    }
  },
  "states": {
    "initializing": {
      "speed": 0.8,
      "params": {
        "nodeCount": 160,
        "nodeSize": 1,
        "surfaceSpeed": 0.6,
        "saturation": 0.4
      },
      "ink": 0.7
    },
    "idle": {
      "speed": 0.6,
      "materials": {
        "pulse": {
          "strength": 0.6,
          "period": 4.5,
          "scale": 0.04,
          "opacity": 0.25
        }
      },
      "ink": 0.8
    },
    "listening": {
      "speed": 0.9,
      "params": {
        "nodeCount": 260,
        "nodeSize": 1.3,
        "surfaceSpeed": 0.28,
        "saturation": 0.6
      },
      "materials": {
        "glow": {
          "strength": 0.3
        }
      },
      "bindings": {
        "audioLevel": {
          "input": "micLevel",
          "curve": "easeOut"
        }
      }
    },
    "thinking": {
      "speed": 1.05,
      "params": {
        "nodeCount": 340,
        "nodeSize": 1.05,
        "surfaceScale": 3,
        "surfaceSpeed": 0.55,
        "saturation": 0.8,
        "hueSpeed": 0
      },
      "materials": {
        "glow": {
          "strength": 0.28
        },
        "pulse": {
          "strength": 0.6,
          "period": 1.8,
          "scale": 0.015,
          "opacity": 0.45
        }
      }
    },
    "speaking": {
      "speed": 1.15,
      "params": {
        "nodeCount": 260,
        "nodeSize": 1.5,
        "surfaceScale": 1.5,
        "surfaceSpeed": 0.5,
        "saturation": 0.62
      },
      "materials": {
        "glow": {
          "strength": 0.45
        }
      },
      "bindings": {
        "audioLevel": {
          "input": "agentVolume",
          "inputRange": [
            0,
            0.8
          ]
        }
      }
    }
  }
}

Structure

  • fxSpec (required): the version, "1.15".
  • object (required) and pattern (required): what to draw. See the catalog.
  • size (20 · 32 · 64) and speed: see Speed & size.
  • ink (1.8): how present the visual is, 0 to 1 (default 1). It fades everything, halos included, and a state can patch it — an assistant rests below full ink when idle and comes to full ink when it listens.
  • color, gradient: see Colour & theme.
  • materials: glow, noise, pulse. See Materials.
  • params: the pattern's own props (the catalog's style props), e.g. "steps": 5 on a constellation.
  • bindings: map your app's inputs onto values. See Bindings.
  • states: a patch per lifecycle state. See States vs patterns.
  • transitions (1.9): how a change between two states animates. See Transitions below.
  • rules (1.9): pick a state from the app's inputs ("10,000 steps → goalReached"). See Rules.
  • accessibility (1.9): the view's spoken name and the words per state. See Accessibility.
  • performance: maxFps, and what to shed under low power.
  • name, description, $schema: for people and editors.

Point $schema at https://sinua.dev/schema/fx-spec-1.json and your editor completes and checks the file as you type.

Versioning

fxSpec is "1.15", written as major.minor (so 1.10 comes after 1.9). A file declares the version it was written for, and a runtime reads every file of its major version: keys it doesn't know become warnings, and a different major is refused. Declaring a version older than the keys you use is an error (transitions in a "1.8" file, say), so write "1.15" and use whatever this page documents. An older file stays valid and renders the same, with the exceptions from before 1.0: object: "edge" (0.1.0-beta.8), the 1.14 cleanup (0.1.0-beta.9: the liquid, particles and holographic materials, the concluding pattern and the character wardrobe) and the 1.15 cleanup (0.1.0-beta.12: what 1.15 removed). A file that uses a removed section gets an error and isn't drawn, and the message says what to delete. After 1.0, a removal only comes in a major version (FX Spec 2.0), after a minor of deprecation warnings.

1.15: light volumes, and the 0.1.0-beta.12 cleanup

1.15 adds ten patterns to object: "signal": veil, crystal, dune, comet, flow, cohesion, scan, constellation, ripple, broadcast (see Signal). They need "fxSpec": "1.15"; an older file that names one gets an error at that pattern.

signal-keys.fxspec.json
{
  "fxSpec": "1.15",
  "name": "Signal keys",
  "description": "One file, three states, each a different light volume with its own key: cohesion (quality), constellation (steps and progress) and scan (blips).",
  "object": "signal",
  "pattern": "cohesion",
  "params": {
    "quality": 0.6
  },
  "states": {
    "stages": {
      "pattern": "constellation",
      "params": {
        "steps": 4,
        "progress": 0.5
      }
    },
    "found": {
      "pattern": "scan",
      "params": {
        "blips": 5
      }
    }
  }
}
  • New keys in params and bindings: level (every signal pattern but dune), quality (cohesion), blips (scan), steps (constellation, a whole number from 2 to 8), progress (dune, constellation), envelope (dune) and churn (all ten).
  • Ten binding targets: progress, level, quality, audioLevel, muted and the material masters (glow.strength, noise.strength, gradient.strength, pulse.strength, color.mix). A target the pattern doesn't read is a warning. See Bindings.
  • The examples that every older version still resolves are three: voice-assistant, voice-assistant-glowing and orb-brand-fixed.
  • Older files resolve exactly as before, apart from what is removed below.

Removed in 1.15

Every item is an error at every version, with a message that names the replacement where there is one and otherwise says to delete it from the file.

  • The objects ring, core and beacon, with all their patterns (completing, loading, tracking, stepping, measuring, talking, generating, typing, notifying, reconnecting, locating, scanning, broadcasting). completing, tracking and measuring say their job is covered by crystal (level) or dune (progress); the others have no replacement. The new comet, flow, scan, constellation, ripple, broadcast are new patterns, not aliases.
  • The flat signal patterns: signaling, waveform and scrolling say to use veil, metering says crystal, and playing says dune.
  • The character family: object: "character" and the keys recipe, expression and palette. No replacement.
  • The orb's silhouette pattern and key. No replacement.
  • Binding targets and parameters: progress0 to progress3 (and progress[0] to progress[3]) and the array parameters progress and segment. quality is a new target of its own, for cohesion.
  • Materials: fills, holes, gradient stops and per-vertex stroke colour no longer exist in the paint contract. The materials left are glow, noise, gradient, pulse and colour.

1.14: the 0.1.0-beta.9 cleanup

1.14 adds no key. It's the version the 0.1.0-beta.9 cleanup ships under, so a "1.14" file is read strictly (its unknown keys are errors).

1.11 to 1.13: characters and silhouettes (removed in 1.15)

1.11 added the character object, 1.12 character recipes and 1.13 the orb's silhouette. All were removed in 1.15. 1.13 also made a voice state a file has no states entry for take the built-in voice behaviour, so a file without states still listens, thinks and speaks; that stays.

Removed: the edge object

object: "edge" (the screen-edge glow, SinuaEdge, <sinua-edge>) was removed in 0.1.0-beta.8. A file with it fails at every version, with an error at /object. There's no replacement: draw a screen-edge glow in your app. It was the first removal before 1.0 (see Versioning).

Removed: three materials

The liquid, particles and holographic materials were removed in 0.1.0-beta.9 (FX Spec 1.14). A file that uses materials.liquid, materials.particles or materials.holographic, or names liquid or particles in performance.lowPower.disable, is rejected at every version, with an error naming the section. Delete the section; there's no replacement. Under low power the host now turns off glow only.

Removed: the concluding pattern

Also in 0.1.0-beta.9: the orb's concluding pattern. A file whose pattern (or a state's) is "concluding" is rejected at every version; pick another pattern.

Removed: the wardrobe, named palettes and eye styles

Also in 0.1.0-beta.9: the character wardrobe and cosmetics, the built-in named palettes and the eye styles. They belonged to the character family, which 1.15 removed altogether.

1.10: calmer voice states

1.10 adds no keys. It made the built-in voice states calmer: listening, thinking and speaking stopped adding particles (see How the states look). The particles material itself was removed in 0.1.0-beta.9, so no version draws them any more.

Transitions

State changes animate, 0.6 s easeInOut unless the file says otherwise. transitions sets the duration and curve per pair of states:

voice-orb-transitions.fxspec.json
{
  "fxSpec": "1.9",
  "name": "Voice orb (with transitions)",
  "object": "orb",
  "pattern": "glowing",
  "size": 64,
  "states": {
    "idle": {},
    "listening": {},
    "thinking": {},
    "speaking": {}
  },
  "transitions": {
    "default": { "duration": 0.6, "curve": "easeInOut" },
    "idle->listening": { "duration": 0.25, "curve": "easeOut" },
    "*->idle": { "duration": 0.9 }
  }
}
  • Keys: default, "from->to", "from->*" and "*->to", with the names from states. The most specific entry wins, field by field: the exact pair, then from->*, then *->to, then default.
  • Fields: duration in seconds, 0 to 10 (0 cuts), and curve: linear, ease, easeIn, easeOut or easeInOut.
  • What moves: when both states keep the pattern, the values interpolate and the shape flows; a change of pattern cross-fades (the orb lattice trio, glowing, calibrating and progressing, morphs point by point). The file sets how long and how; the engine picks the technique.
  • A view's crossFade option, when you set it, overrides every change's duration (0 still cuts).

Resolving a spec yourself

Views resolve specs for you. To inspect what the engine will draw, for tooling or tests, resolve one directly:

mount-spec.ts
import { resolveFxSpec } from "@sinua/core";
import spec from "../spec/voice-orb.fxspec.json";

// Resolve once to see what the engine will draw for a lifecycle state.
const r = resolveFxSpec(JSON.stringify(spec), {
  state: "listening",
  inputs: { micLevel: 0.4, micMuted: 0 },
});
if (!r.ok) console.error(r.diagnostics);
console.log(r.state, r.overrides); // "listening" pattern, with audioLevel bound to micLevel

Every key

Top level

KeyTypeDescription
$schemastring
fxSpecstring"major.minor", 1.8 or later (the runtime's floor; 1.0-1.7 are rejected). The runtime reads up to 1.15 strictly; a newer 1.x file resolves, with its unknown keys reported as warnings.
namestring
descriptionstring
object
patternstringThe visual pattern, e.g. working, veil, tracking, scanning, generating. Must belong to object's family.
size
speednumberMultiplier on the preset's tuned speed; frameFromFxSpec applies elapsed * presetSpeed * speed.
inknumberFX Spec 1.8: the whole visual's opacity, 0 to 1. 1 draws it as the pattern defines it; lower fades everything, halos included. A state patches it (a voice assistant's idle typically sits below 1).
colorA color (shorthand for { value, mix: 1 }) or the full section.
gradientobjectsee gradient
materialsobject
paramsobjectPer-state engine opts (docs/parameters.md). Runtime inputs (pointer*, audio*, interrupt*, muted*, voiceStateCode) and section-owned keys (color*, gradient*, glow*, noise*, pulse*) are rejected here. FX Spec 1.7: envelope may be an array.
bindingsobjectsee bindings
statesobjectLifecycle key -> design entry, merged over the top-level design (RFC 7396: objects merge, null deletes, arrays replace). Keys are free-form; LiveKit's AgentState names (initializing, idle, listening, thinking, speaking) are the convention. A state not listed renders the top-level design.
performanceobjectsee performance
transitionsobjectsee transitions
rulesobjectsee rules
accessibilityobjectsee accessibility

A states entry

KeyTypeDescription
patternstringThe pattern for this lifecycle key; defaults to the top-level pattern.
speednumber
inknumberFX Spec 1.8: this state's opacity; inherits the top-level ink when absent.
colorobject | null
gradientobject | null
materialsobject | null
paramsobject | null
bindingsobject | null

A binding

KeyTypeDescription
inputstringThe app's input name (e.g. micLevel, steps, heartRate); the engine never interprets it. Missing at runtime = binding inactive.
inputRangearray
outputRangearrayDefault: the target's range.
curve

Bindable targets: progress, level, quality, audioLevel, muted, glow.strength, noise.strength, gradient.strength, pulse.strength, color.mix.

Deprecated aliases (FX Spec 1.6 and earlier; still accepted, with a warning in a 1.7 file): state → pattern, glowStrength → glow.strength, noiseStrength → noise.strength, gradientStrength → gradient.strength, pulseStrength → pulse.strength, colorMix → color.mix. See the rename map.

color

KeyTypeRangeDescription
valueobjectsee color
mixnumber0–1
lightnessnumber-1–1
modeenumink · fixed

gradient

KeyTypeRangeDescription
stopsarray
anglenumber-360–720
strengthnumber0–1
saturationnumber0–1
midnumber0.05–0.95
pathenumshort · long

materials.glow

KeyTypeRangeDescription
strengthnumber0–1
radiusnumber1–8
layersnumber1–8
tintnumber0–1
huenumber0–360
modeenumstacked · blurstacked = concentric copies (every renderer); blur = one Gaussian-blurred halo per element (paint-contract blur). Low power with disable: ["blur"] falls back to stacked.
blendenumnormal · additiveHow blur-mode halos composite: additive = Canvas lighter / SwiftUI plusLighter / Compose BlendMode.Plus.

materials.noise

KeyTypeRangeDescription
strengthnumber0–1
amplitudenumber0–1
scalenumber0–64
speednumber0–16
seednumber

materials.pulse

KeyTypeRangeDescription
strengthnumber0–1
periodnumber0.05–60
opacitynumber0–1
scalenumber0–1
phasenumber

performance

KeyTypeRangeDescription
maxFpsnumber1–120Frame-rate cap the host should honour. Absent = the host's default.
lowPowerobject

On this page