Everything on the canvas is a function call. The code re-renders live as you type
(Ctrl+Enter forces a run). Painting with any tool writes code back
into the editor. With Select: drag an object to move it, drag a corner handle to
resize it, press Delete to hide it - each rewrites the actual numbers in the
call that painted it, and selecting highlights that exact line in the editor.
Recolour rewrites an object's color: literal; Eyedropper picks
a colour off the canvas. Undo / Redo (Ctrl+Z /
Ctrl+Y) covers gestures, imports and rewrites.
Import image (or dropping a file on the canvas) traces any PNG, JPG or SVG into a
named layer() of editable shapes at your chosen detail level - imports stack,
and the Layers strip reorders, hides or scales each one.
The canvas is 960 Γ 600; constants W, H, PI are available.
| sky({from, to}) | Vertical sky gradient over the whole canvas. |
| sun(x, y, r, {color, glow}) | Sun disc with a radial glow. glow scales the halo. |
| moon(x, y, r, {color, glow}) | Moon with faint craters and halo. |
| stars(n, {max, color}) | n stars in the top max (0-1) of the sky; big ones sparkle. |
| clouds(n, {y, color, scale}) | Puffy clouds drifting around height y. Each cloud is selectable. |
| mountains({layers, base, height, color, fade, roughness}) | Layered ridgelines with atmospheric fade toward fade. |
| hills({...}) | Softer, rounder mountains. |
| water({from, color, deep, reflect}) | Water from y downward. reflect (0-1) mirrors everything above the waterline - captured after the whole scene is painted, so trees and birds added later still reflect. reflect: [0.35, 'inplace'] restores paint-order capture (only what was painted before the water reflects). |
| ground(y, {color}) | Solid ground plane from y down. |
| tree(x, y, size, {color, type}) | One tree at its base point; type 'pine' or 'round'. |
| trees(n, {from, to, base, size, color, type}) | n trees scattered between x = from...to. |
| grass(y, {color, height, density}) | Swaying grass blades along a baseline. |
| birds(n, {x, y, spread, size, color}) | A flock of distant birds around (x, y). |
| fog(opacity, {y, height, color}) | Soft horizontal mist band centred on y. |
| circle(x, y, r, {color, opacity, stroke, strokeWidth}) | Filled circle. |
| ring(x, y, r, {color, size}) | Outlined circle. |
| rect(x, y, w, h, {color, opacity, round}) | Rectangle, optional corner radius. |
| ellipse(x, y, rx, ry, {color, rotate}) | Ellipse, rotation in radians. |
| line(x1, y1, x2, y2, {color, size}) | Straight stroke. |
| polygon(points, {color, smooth, seal}) | Closed filled polygon from [[x,y], ...]. smooth: true draws it as a flowing curve through the points instead of straight edges; seal: true outlines it in its own colour to close hairline gaps between traced shapes. |
| form({x, y, w, h, color, shade, pts}) | A traced painting mass with readable placement: x, y is its centre, w, h its size - edit those numbers (or click one for a slider) to move and stretch it. color is its dark tone; shade: ['#tone', angleΒ°] grades it toward a lit tone in that direction, sampled from the imported photo. pts holds the packed outline (leave it be; delete it and the form becomes a plain rectangle). What the image tracer writes; positional form(x, y, w, h, {...}) also works. |
| triangle(x1,y1, x2,y2, x3,y3, {color}) | Filled triangle. |
| star(x, y, spikes, outer, inner, {color}) | Star polygon. |
| ngon(x, y, sides, r, {color, rotate}) | Regular polygon - diamond (4), pentagon (5), hexagon (6)... |
| arrow(x1, y1, x2, y2, {color, size, head}) | Arrow from tail to tip. |
| heart(x, y, size, {color}) | Heart centred at x, y. |
| crescent(x, y, r, {color}) | Crescent moon opening left. |
| stroke(points, {brush, color, size, opacity}) | A painted stroke - what the Paint tool writes. Points are [x, y] or [x, y, pressure] (0-1, from your pen or synthesized from mouse speed). brush picks from the library below; without it you get a clean plain line. Legacy nib: 'chisel' still works. |
| spray(points, {color, size, density, opacity}) | Airbrush dots along a path (also available as the Airbrush brush). |
| text(x, y, str, {size, color, font, align}) | Painted lettering. |
All brushes are pressure- and direction-aware stamp engines - press harder (or move slower
with a mouse) for wider, denser marks. Keys 1-9, 0 switch brushes.
| seed(n) | Fixes the randomness so the painting re-renders identically. |
| rand(a?, b?) | Seeded random: rand() β 0-1, rand(a,b) β a-b. |
| noise(x) | Smooth 1-D noise, 0-1 - for organic variation. |
| layer(name, {x, y, scale, hidden}) | Start a named layer: everything painted after it belongs to that layer until the next layer(). The Layers strip above the canvas reorders, hides and scales these by rewriting this call. Imports create one automatically. |
| repeat(n, i => { ... }) | Run a block n times - loops of shapes, patterns, orbits. |
| resize(i, factor) | Scale the i-th painted object around its centre. Written automatically when handle-resizing a loop-made object. |
| nudge(i, dx, dy) | Move the i-th painted object by an offset. You rarely write this: dragging with Select edits coordinates directly, and only falls back to nudge() when the object was born inside a loop or flock (one call, many objects), where there is no single literal to rewrite. |
| hide(i) | Hide the i-th painted object (Select + Delete writes this). |
Object indices follow paint order, top of the code downward - the
status bar shows an object's index when you select it. If you insert new calls above
existing nudge/hide lines, their indices shift with the paint order.