Guide · 03 of 09
Scene & State
A Prism file is exactly one scene <type> { ... } block. Everything else — space config, state, objects, controls, timeline — lives inside it.
scene#
type is plane (2D cartesian) or numberline (1D axis). For plane, both x: and y: are required. For numberline, only x: is needed. The space config lines can appear anywhere in the block, in any order, alongside state/object/control declarations.
By default the x and y domains are stretched independently to fill the box, so a circle only looks round if the domains happen to match the box. Add aspect: equal when shape matters — unit circles, Argand diagrams, geometry, force diagrams — and one shared scale is used for both axes, letterboxed inside the same space.
scene <type> { x: [min,max] [y: [min,max]] [grid] [axes] [aspect: equal] ... }
| prop | type | description |
|---|---|---|
| x* | [number, number] | x-axis domain |
| y | [number, number] | y-axis domain (plane only) |
| grid | flag | draw a background grid (plane only) |
| axes | flag | draw axes. they are on by default — write axes: false to hide them |
| aspect | equal | one scale for both axes, so circles stay round (plane only) |
Example
param#
Declares a numeric state variable. Controls (sliders, steppers) and draggable objects write to it; object expressions read from it. The { ... } block is optional — omit it if there is nothing to configure.
param <name> = <number> { [range: [min,max]], [step: <number>] }
| prop | type | description |
|---|---|---|
| range | [number, number] | min/max bounds for controls |
| step | number | discrete step size |
Example
bool#
Declares a boolean state variable. Toggles write to it; show: on objects reads from it.
bool <name> = <true|false>
Example
choice#
Declares a string-valued state variable restricted to a fixed set of options. A picker control writes to it; object expressions read it and compare with ==.
choice <name> = " { options: ["a", "b", ...] }
| prop | type | description |
|---|---|---|
| options* | string[] | the allowed values, required |
Example