Garden source
Follow a frame from the browser’s animation loop through Rust and Luau, then back to the page as SVG sprites. Each filename opens the source on GitHub.
The Luau you can edit
wandering-flowers.luau- The script shown in the homepage editor. It chooses where each flower moves and calls
sprite()to draw it. flowerbed.luau- Keeps existing flowers across edits. Changing the flower count adds or removes only the difference.
drawing.luau- Checks the arguments to
sprite(), fills in defaults, and passes the drawing request to Rust. garden-api.luau·sprite-names.txt- Defines the garden’s script helpers and the named sprite kinds.
How a frame runs
garden-player.mjs- Schedules frames in the browser, sends time and pointer input to the worker, and switches to an edited script after it renders successfully.
worker.mjs·bridge.rs- The worker loads the Rust WebAssembly module. The bridge exposes the Rust session to JavaScript and passes its sprite requests back to the worker.
garden.rs- Embeds Rustia, loads the Luau files, and calls the script’s
setup()andupdate()callbacks. draw-garden.mjs·sprite-defs.html- The browser places SVG sprites using the positions returned by the worker. The HTML file supplies the shapes and colours.
The page and editor
index.html·garden-fragment.html·garden.css- The homepage, the markup for the animation and its controls, and the layout and styles.
garden.mjs- Connects the page controls to the player, maps pointer input to garden coordinates, and remembers drafts locally.
source-editor.mjs·editor.mjs·garden.d.luau- The shared editor view and file handling, plus the garden API definitions used for autocomplete and hover help.