Guide · 04 of 15
Objects
Objects are the visual elements of a scene. Properties go in a trailing { key: value } block — omit it entirely if the object needs no configuration. All objects accept: color, style (solid/dashed/dotted), show:<expr>, width:<number>. Note: curve, rect, circle, polygon, arc, image require plane scenes; a numberline draws point, label, line, vector and brace (see numberline).
curve#
Plots f(x) across the domain. Give it a (x, y) pair instead to trace a parametric curve over the parameter t — supply t: [start, end]. State variables can appear in either form. A vertical asymptote (tan(x), 1/x, ...) breaks the stroke automatically — no special syntax needed, just let the domain span the pole.
curve <id> = <expr> { [props] } OR curve <id> = (x(t), y(t)) { t: [start, end], [steps: <n>] }
| prop | type | description |
|---|---|---|
| t | [start, end] | parameter range (parametric form only) |
| steps | number | sample count for parametric curves |
| where | expr | boolean in x — draw the curve only where it holds (piecewise) |
| label | string | TeX name drawn at the visible end of the curve, in its colour |
| draw | expr | auto | draw: auto draws the stroke on over 600ms each time the curve appears (solid only); draw: <0..1> is the progress by hand |
Example
area#
Shades the region under a curve. Fills between y = <upper expr> and y = 0 (or lower: for a second curve), clipped to x in [from, to] (defaults to the scene domain). from/to can bind to state, so a slider can sweep the shaded width.
area <id> = <upper expr> { [from: <n>], [to: <n>], [lower: <expr>], [opacity: <n>] }
| prop | type | description |
|---|---|---|
| from | expr | left x bound (default xMin) |
| to | expr | right x bound (default xMax) |
| lower | expr | lower boundary curve (default y = 0) |
| opacity | number | fill opacity (default 0.15) |
Example
point#
A point at scene coordinates (x, y). Both coords can be expressions. drag makes it draggable — axis is x, y, or xy; bind is the state key updated by the drag. snap rounds the dragged value to the nearest step (grid = nearest 1). drag: along(<objId>) -> <bind> constrains the drag to a circle or two-point line object — bind receives an angle (radians) for a circle, or 0..1 for a line segment; the point's own position should already be an expression of that param. The bare open flag draws a hollow (unfilled) marker instead of a solid disc — the standard way to mark a removable discontinuity or an excluded one-sided limit endpoint. The bare trace flag leaves a faint trail wherever the point has been, so a path appears as the student drags or a step animates it.
Any object can take ghost: { a: [1, 2, 3] } to draw faint copies of itself for those values of a param, all at once. Small multiples in one scene: the student compares the family while dragging the real one. A point3 and a point on a numberline take it too.
point <id> = (x, y) { [drag: <axis> -> <bind>], [snap: <n>|(nx,ny)|grid], [r: <number>], [label: "text"], [open], [props] }
| prop | type | description |
|---|---|---|
| drag | axis -> bind | make it draggable, writes state |
| snap | number | (number, number) | grid | round the dragged value(s) to a step |
| r | number | radius in pixels (default 6) |
| label | string | text label next to the point |
| labelOffset | (x, y) | nudge the label by (dx, dy) screen pixels, y down, from where it would sit |
| open | flag | draw a hollow marker instead of a filled disc |
Example
line#
A line segment uses -> arrow syntax. For an infinite line through a point, omit = and put through: and slope: in the props block instead.
line <id> = (x1,y1) -> (x2,y2) { [props] } OR line <id> { through: <obj_id>, slope: <expr>, [props] }
Example
label#
Text positioned in scene coordinates. Use ${expr} in the text for live-updating values (rounded to 2 dp). Add tex flag to render as LaTeX via KaTeX. anchor: says which end of the text sits on (x, y) — the default start runs the text rightwards, middle centres it, which is what you want for a column of numbers of different widths.
label [id] at (x, y) = <text> { [size: <number>], [anchor: start|middle|end], [tex], [props] }
Example
rect#
(x, y) is the bottom-left corner in scene coords. Width and height are expressions. rotate: tilts the rectangle counter-clockwise by that many degrees about (x, y), so the anchor stays put and the body swings around it — that is what puts a block on a ramp. The angle can be live state, and the rotation happens in scene coords, so it stays correct with or without aspect: equal.
rect <id> = (x, y) { w: <expr>, h: <expr>, [rotate: <expr>], [opacity: <number>], [props] }
Example
circle#
Circle centered at (x, y) with radius r in scene units.
circle <id> = (x, y) { r: <expr>, [opacity: <number>], [props] }
Example
polygon#
Closed polygon. Vertices are a list [...] of (x, y) tuples. rotate: turns the whole shape counter-clockwise by that many degrees about the first vertex.
polygon <id> = [(x1,y1), (x2,y2), ...] { [rotate: <expr>], [props] }
Example
vector#
An arrow from (x1,y1) to (x2,y2). All coords can be expressions.
vector <id> = (x1,y1) -> (x2,y2) { [props] }
Example
arc#
An arc centered at (x, y), from from degrees to to degrees (counter-clockwise). Useful for angle markers.
arc <id> = (x, y) { r: <expr>, from: <degrees>, to: <degrees>, [props] }
Example
image#
(x, y) is the bottom-left corner in scene coords; width/height are expressions. src must be an http(s) URL, a data:image/ URI, or a root-relative path — nothing else compiles. alt is required: it becomes the image's accessible description, so write what it shows, not just its filename.
image <id> = (x, y) { w: <expr>, h: <expr>, src: "" , alt: "" , [opacity: <number>] }
| prop | type | description |
|---|---|---|
| src* | string | http(s) URL, data:image/ URI, or /path |
| alt* | string | required accessible description |
| opacity | number | fill opacity (default 1) |
Example
numberline#
On a numberline every position is (x, 0) and y is ignored. A line is a thick band between its two x values, and a point marks each end, with open for an end that is left out, so (-2, 3] is a band, an open point at -2 and a closed one at 3. A band whose end lies past the axis runs off the edge with an arrowhead, which makes it a ray. A vector is a jump, an arc above the axis from x1 to x2 with the arrowhead at x2. A brace sits above the axis over [x1, x2] with its label. A band has two ends, so through: and slope: are errors here, and draw: and ghost: work only on a point.
line | vector | brace <id> = (x1, 0) -> (x2, 0) { [props] }
Example
context#
A bare flag on any object in a plane, numberline or space3 scene. The object steps back: neutral grey, hairline width, half-strength fill, labels in the axis grey, whatever its color: says. Use it for supporting geometry, so the thing being taught is the only thing at full strength. A timeline focus still dims on top.
<object> { context }
Example