Aster · v2 · a tech showcase

Less code. Faster frames. Then everything at once.

Today a desktop app usually ships a whole web browser and runs a single-page web app inside it: a framework, a bundle, a virtual DOM, a JavaScript engine and several processes, all to draw some text and boxes. Aster is the other way. Native code lays out and draws the pixels itself: no browser, no DOM, no JavaScript engine, one small binary. It draws the same bytes every time, so an AI can write a screen, look at it and test it.

The same picture takes 1.9x to 4.7x fewer tokens of code than the browser way. An app built with it ships as a 10 MB file, runs as one process and shows its first window in about a third of the time of an Electron app on the same machine. Measured, below.

Tokens of code, same picture
1.9x–4.7x fewer
9 pairs, o200k_base
Idle 1080p cinematic frame, CPU
574.2 ms before, now 3.8 ms
OPT-BUILD.md:979
An app built with it opens a 2,361,372-word file
105 ms
aster-md, process start to first frame
aster-md with a note called Field notes on white paper: a pull quote with an orange quote mark, a launch checklist with an orange progress meter at 2 of 4 done, a tip and a warning callout, and the top of a table. A breadcrumb and a Saved badge sit in the bar above.
aster-md, a markdown editor built with Aster: the running example on this page. A headless render by the app, at its real size; it is in development.

01 · Token efficiency

Same picture, fewer tokens.

Nine screens, each written twice: the browser way, with HTML, CSS and the libraries a web team reaches for (three.js, matter.js, GSAP, ECharts, WebGL), and the Aster way. Then we counted what it takes to write each one: the tokens of code a person, or their AI, types.

Aster took fewer in every pair, from 1.9x to 4.7x fewer, and 6,970 against 17,274 over all nine. Fewer tokens is a cheaper, faster answer from a model, and less code for it to get wrong.

Counted with the open tiktoken o200k_base tokenizer, one rule for both sides: non-blank, non-comment lines, indentation removed; libraries and measuring code not counted. Where the numbers come from ↓

The biggest screen in the set, a dense ops deck, written twice: 2.1x fewer tokens with Aster.
EverydayA plain list with a counter
3561,125 HTML + CSS + JS
3.2x fewer with Aster
LightSunlight through fog
9111,714 three.js
1.9x fewer with Aster
3D in the pageA 3D logo that lands on the cards
6021,330 three.js + DOM
2.2x fewer with Aster
PhysicsConfetti that piles up
6951,681 matter.js
2.4x fewer with Aster
MotionA click that shakes the page
4931,159 GSAP
2.4x fewer with Aster
SurfacesFrosted glass, raised controls
5672,673 CSS
4.7x fewer with Aster
ColourGradients that flow
4651,630 CSS + WebGL
3.5x fewer with Aster
FinishA film finish over the page
1,2672,502 WebGL
2.0x fewer with Aster
EverythingA dense ops deck
1,6143,460 ECharts + CSS
2.1x fewer with Aster

At app scale

aster-md was written by two AI agents working with Aster, one on the document engine and one on the app. The whole app, from the window to the paper to every table menu, is 11,562 lines of Rust (117,387 tokens); the engine under it is 17,706 lines (172,568 tokens). An app this size has no twin built the usual web way, so there is no ratio to give here: the pairs above are the comparison. Counted with the same rule, at ecbe5c4.

02 · Speed, as measured

Fast where it's measured.

Most of the cost of a desktop app today is not the app. It is what sits between the app's code and the pixels: a browser engine with its own processes, a JavaScript engine, a DOM, a style and layout engine and a compositor, shipped again inside every app.

In Aster that stack is one library. Your code says what the screen is; Aster lays it out and draws it, redrawing only what changed. Every number below is from Aster's own measurement notes or measured for this page, with what it measures. Where something is slow, it says so.

The browser way

  1. Your app
  2. UI framework + virtual DOM
  3. Bundled JavaScript
  4. JavaScript engine
  5. DOM, CSS, style and layout
  6. Compositor and GPU process
  7. IPC between processes
  8. Pixels

The Aster way

  1. Your app
  2. Aster: layout and drawing
  3. Pixels
What sits between your code (top) and the pixels (bottom).

The GPU frame accelerator merged · optional · not in a release

One line, aster_gpu::install(&mut app, Gpu::Auto), hands the full renders (first frame, resize, theme change, fades) to the GPU through wgpu; small changes stay on the CPU's damaged-region path. Measured on an RTX 3070 Ti, Linux, Vulkan, headless, median ms per operation, the same build with the GPU off and on:

Settings resize 1x
CPU 3.8GPU 2.3
Settings resize 2x
CPU 11.5GPU 6.5
Print farm resize 1x
CPU 6.1GPU 3.1
Print farm resize 2x
CPU 18.6GPU 10.3
Mission control resize 1x
CPU 12.3GPU 6.8
Mission control resize 2x
CPU 39.8GPU 16.8
Team chat resize 1x
CPU 7.9GPU 5.3
Team chat resize 2x
CPU 15.7GPU 12.2
Settings fade 2x
CPU 6.1GPU 4.3
Print farm fade 2x
CPU 9.5GPU 6.4
  • Same pixels, within one level. Full frames match the CPU reference with a worst channel difference of 1 in 255 (mean 0.015); the documented tolerance is 2. A lost GPU falls back to frames byte-identical to the CPU's.
  • Slower, too, and measured. full-screen scrim fade, print farm, 1x: 11.1 → 12.8 ms; full-screen scrim fade, print farm, 2x: 41.7 → 50 ms; first fade frame, cold tile cache, settings, 2x: 40 → 72 ms. There the CPU already repaints only the overlay, and frames with additive light still run wholly on the CPU.
  • aster-md does not use it. Its frames are small changes and text scrolls the CPU already draws fast; the GPU added half a second at start and about 200 MB. Measured both ways in the app's README.

gpu/README.md, aster-ui main 3006e4c51; aster-md crates/app/README.md

A cinematic desktop inside the frame budget

The dusk-eclipse desktop at 1920x1080 on the CPU alone: a generated sky, light shafts, bloom, frosted glass and a ticking clock. After the optimisation rounds its median frames fit a 120 Hz budget, and the living sky's worst frame fits 60 Hz.

Dusk desktop frame times, ms, before and after
FrameBeforeNow
Idle frame574.2 ms3.8 ms
Clock tick464.1 ms2.61 ms
Focus moves459.5 ms1.5 ms
Living sky (median, worst 11.3)new7.7 ms

OPT-BUILD.md lines 979, 980, 982, 1090 and 1092 (aster-ui main b5055d3a)

An agent's loop in milliseconds

Click, then read the screen back
1.02 ms
Read the semantic tree
0.04 ms
JSON to PNG, fresh process
168.7 ms (headless Chromium: 355)
Distinct picture hashes in 80 runs
1

Runtime 0.1.0 on a busy 96-thread server, so upper bounds.

What that means in a real app

Starting a desktop app three ways, on one machine
Measuredaster-mdAster, nativeopens the 2 KB noteEdge 157browser app windowthe same note as a static pageDbGate 7.2.5Electron 38 appopens to its start screen
Installed size10 MB894 MB520 MB
Processes17 to 104
First window, files not cached55 ms213 ms320 ms
First window, warm86 ms250 ms249 ms
CPU goes quiet after271 msnot in 30 s (3 of 5)not in 30 s (5 of 5)
Memory: working set117 MB544 MB481 MB
Memory: private bytes258 MB299 MB336 MB
CPU used in 10 s idle0 ms, every run47 ms (31 to 797)0 to 16 ms

Measured for this page on 2026-11-07 on one desktop (24-thread Intel Core Ultra 9 285K, 64 GB, Windows 11). aster-md dist build f3222be; Microsoft Edge 157.0.4341.42 in an app window showing the same note as plain HTML, the least a browser can do; DbGate 7.2.5, a database client built on Electron 38.6.0 (Chromium 140), the one Electron app here that starts without a sign-in. Each app ran on a hidden desktop: nothing on screen, no input. Warm figures are the median of 5 runs, cold is one run after purging the app's files from the file cache. Installed size is the app's own folder; for Edge, one version of it. Windows counts CPU time in 15.6 ms ticks, so idle is 0 or a multiple of that; idle is over 3 runs (Edge's 797 ms run started a helper process mid-window).

Where Aster is ahead: a 10 MB file instead of 520 to 894 MB, one process instead of four to ten, a first window in about a third of the time, and a CPU that goes quiet within a third of a second. Idle is a tie with the Electron app once it settles; it just did not get there in the 30 seconds we watched. Memory is closer than it looks. The working set is a quarter of the others', but private memory, what the app has set aside, is 258 MB, between Edge's and DbGate's. Most of that is aster-md's paper textures and fonts, decoded up front so drawing never waits on them. A plain page holds less of that. It is the number to watch.

aster-md is a markdown editor built with Aster, and it is the test of all this on a real app. Its first frame needs only the first 256 KB of a file: the rest is read in the background. So the first page costs the same for a small note and for a 100 MB file, and opening a 12 MB file of 2,361,372 words takes 105 ms from process start to the first frame on screen.

Find does not wait either. Search starts while the file is still loading, and the first hits show within 4.5 ms of opening a 100 MB file.

A work laptop is often busy with other software. So every number in the table below was also measured with the engine pinned to one core, sharing it with two threads that do nothing but spin. And because Aster only draws what changed, an idle window wakes 0 times: nothing runs until something changes.

huge.md open: a heading, a small table and generated paragraphs on white paper. The status line reads 10267 min read and 2,361,372 words.
aster-md with the 12 MB test file open: 2,361,372 words.
aster-md's document engine on a 100 MB file of 1.25 million lines
WhatIdle desktopOne busy core
First view of a 100 MB file0.53 ms0.55 ms
First view, file not in the OS cache1.66 ms1.57 ms
A keystroke (apply and re-fetch), median15 µs16 µs
Find in 100 MB: first hits33 ms105 ms
Save 100 MB in the background: cost to typing0.05 ms0.05 ms
A keystroke on one 50 MB line0.21 msnot measured

aster-md bench/README.md and PRODUCTION.md at ecbe5c4, on a fast desktop. The 105 ms is one real window opening the 12 MB file, 39 ms of it building the first frame. The engine passes 10,000 random parser seeds and 10,000 random edit seeds.

03 · What Aster gives you

What you get, shown in a real app.

Each capability below is shown in aster-md. Aster draws every pixel and gives the same bytes every time, so each picture is a headless render by the app: the same picture an AI agent looked at and checked while it built it.

  • Five strips of the same note, Field notes with its quote, checklist and callouts, each on a different paper labelled Cotton, Laid, Vellum, Recycled and Slate.
    aster-md's five paper stocks, each a set of layers computed by the app, no bitmaps.

    Materials and light, built in

    Aster's effect layers let an app paint its own surfaces pixel by pixel: grain, fibres, edge light, shadow, a film grade. Aster bakes each layer once per size and serves it from its cache, so an idle or scrolled frame costs a cache hit, not a repaint.

  • A seed order table with a column menu open on Bed: sort A to Z or Z to A, a filter with values ticked, alignment buttons and column commands. A badge says 2 of 6 rows hidden.
    A column menu: sort, filter by value, align, insert and move columns.

    Rich layout and widgets

    Rows, columns, overlays, menus and text inputs are the same few building blocks in every Aster app. Put together, they make a table that sorts, filters and selects ranges like a spreadsheet, and pages that hold other files.

  • The same table with a block of cells selected across two columns and three rows, and one cell being edited.
    A range of cells selected across two columns, one cell being edited.
  • Field notes with two embedded files: a plan with its own checklist and tip, and harvest.csv shown as a table of crops, beds, weights and dates.
    Another note embedded in the page, live and read-only; a CSV shown as a table.
  • The same notes with a preview card floating over a link: the linked plan's title, its first lines and its checklist.
    A preview card over a link.
  • The typography panel open beside the page, listing Modern, Classic, Editorial, Book, Report and Humanist pairings, with size and measure buttons. Report is chosen and the page behind is set in it.
    aster-md's typography panel: six pairings, four sizes, three line lengths. Report is chosen.

    Typography that reflows live

    Aster measures and lays out text itself, so a new font pairing, size or line length is just a new state: the page reflows with no reload.

  • Motion that costs nothing at rest

    Aster redraws only what moved, so motion stays cheap and a still window stays idle. aster-md moves its ticks, progress meter, caret, sidebar and scroll on springs of its own, settled without overshoot. Aster's physics lane, Kine (bodies, springs, fields), runs the finale below; it is not in a release yet.

    aster-md's 15-second reel, rendered headless by the app.

  • One file per screen

    In Aster an app is a function from its state to a screen: rows, columns, text and charts, built from roles and spacing steps instead of colours and pixels. JavaScript, C# or Rust.

  • Any size

    The same file reads the size it was given and picks a layout: a phone column, a tablet grid, an ultrawide row.

  • Built for your AI

    Byte-identical renders, a semantic tree to assert on, scripted clicks and errors that carry their own fix: a model can build it, look at it and check it without a window.

Not only editors

The same kit draws dashboards, games, kiosk screens and phone apps. Here is one 47-line JavaScript app, market-day.js, rendered by the Aster Runtime at four sizes. The nine screens in the token pairs above are more of its range: light through fog, physics, frosted glass, a film finish.

  • Market Day, one JavaScript file, at ultrawide size.Ultrawide
  • Market Day, one JavaScript file, at tablet size.Tablet
  • Market Day, one JavaScript file, at phone size.Phone
  • Market Day, one JavaScript file, at kiosk size.Kiosk

04 · Getting started: three steps, no programming

Start with your AI.

  1. Install the runtime

    One install per computer lets it show Aster apps. Windows and Linux packages are coming soon.

    Install notes
  2. Paste a starter prompt

    Pick an idea, copy one block into ChatGPT, Claude or Copilot, or remix a working template.

    Starter prompts
  3. Give your AI the notes

    Everything a model needs to write Aster is one file of 2,162 tokens (7,615 characters). The prompts already include it; save it once and every chat knows Aster.

Starter prompts

Each button copies one block: what to build, plus the notes that teach your AI how Aster works. Paste it into a new chat in ChatGPT, Claude or Copilot. Change the words first if you like; the AI will follow them.

  • dashboard

    A dashboard for something I watch

    Build me a desktop dashboard with Aster in JavaScript. It should show [what you want to watch, e.g. my home network, my sales, the weather in my town] as big numbers, small charts and status dots, with a refresh button. Make up realistic sample data for now and tell me where to plug in the real numbers. Give me the whole app in one file and the exact commands to run it.

    Copies this request plus the Aster notes, as one block.

  • tracker

    A tracker for my habits, chores or collection

    Build me a tracker app with Aster in JavaScript for [habits / chores / books / plants]. I want to add items, mark them done, and see progress for the week. Save everything to a file next to the app so it is still there tomorrow. One file, and tell me exactly how to run it.

    Copies this request plus the Aster notes, as one block.

  • kiosk

    A kiosk or welcome screen

    Build me a full-screen kiosk app with Aster in JavaScript for [my shop / front desk / event]. Big friendly text, a live clock, and large buttons for [list what visitors can do]. Use a light theme and make everything readable from a few feet away. One file, plus the commands to run it.

    Copies this request plus the Aster notes, as one block.

  • game menu

    A title screen for my game

    Build me a game title screen with Aster in JavaScript for a game called [name]. Main menu with [Continue, New game, Settings, Quit], a settings panel with volume, music and subtitles, and a news panel. Use the high contrast dark theme. One file, plus how to run it.

    Copies this request plus the Aster notes, as one block.

  • photo wall

    A photo wall for a folder of pictures

    Build me a photo wall app with Aster in JavaScript. It should show every PNG in the folder [folder path] as a grid of cards with their names, open one large when I click it, and have a slideshow button. One file, plus how to run it.

    Copies this request plus the Aster notes, as one block.

  • form

    A form that saves what people type

    Build me a form app with Aster in JavaScript for [what it is for, e.g. event sign-ups]. Fields: [list them]. Check that the answers look right, save each one to a CSV file, and show a thank-you message. One file, plus how to run it.

    Copies this request plus the Aster notes, as one block.

Or remix a template

Real Aster apps, with their code. Press Remix with your AI and say what you want changed; your AI gets the app and the notes in one paste.

  • dashboard · JavaScript

    Home lab dashboard

    Machines, storage, network and services on one screen, with refresh and wake buttons.

    Copies a request to change it, the app's code and the Aster notes.

    View the source
    // Home lab dashboard: machines, storage and services at a glance.
    const { app, col, row, grid, card, panel, header, stat, meter, sparkline, status, badge, keyValues, button, text } = require('@barnyardgreens/aster');
    
    const machines = [
      { name: 'nas', cpu: 0.18, mem: 0.41, up: true },
      { name: 'media', cpu: 0.62, mem: 0.70, up: true },
      { name: 'backup', cpu: 0.05, mem: 0.22, up: false },
    ];
    
    app({ title: 'Home Lab', width: 960, height: 600, state: { refreshed: 'just now' } })
      .view((s) =>
        col(
          header('Home Lab', `updated ${s.refreshed}`, badge(`${machines.filter((m) => m.up).length}/${machines.length} UP`, 'success')),
          col({ gap: 4, pad: 4 },
            grid(4, { gap: 4 },
              card(stat('Storage used', '6.2 TB'), meter('of 12 TB', 0.52, { role: 'info' })),
              card(stat('Network', '412 Mb/s'), sparkline([120, 200, 180, 340, 290, 412, 380, 412])),
              card(stat('Power', '148 W'), status('Normal', 'success')),
              card(stat('Backups', 'Nightly'), status('Last run 2:00 AM', 'success'))),
            row({ gap: 4, align: 'start' },
              panel('Machines', 'CPU and memory', { grow: 1 },
                ...machines.flatMap((m) => [
                  row({ gap: 2 }, text(m.name, { bold: true }), status(m.up ? 'online' : 'offline', m.up ? 'success' : 'danger')),
                  meter('CPU', m.cpu, { role: m.cpu > 0.5 ? 'warning' : 'accent' }),
                ])),
              panel('Services', 'what is running', { grow: 1 },
                keyValues({ 'Media server': 'running', 'Photo backup': 'running', 'DNS filter': 'running', 'VPN': 'stopped' }),
                row({ gap: 2 }, button('Refresh', (st) => { st.refreshed = new Date().toLocaleTimeString(); }), button('Wake backup', () => { machines[2].up = true; }, { tone: 'info' })))))))
      .run();
    
  • dashboard · JavaScript

    Garden tracker

    Soil, greenhouse and harvest at a glance, watering bars per bed and a quick notes box.

    Copies a request to change it, the app's code and the Aster notes.

    View the source
    // Garden tracker: sensors, beds and a quick log. The whole screen is plain data, so an AI can edit it easily.
    const { app } = require('@barnyardgreens/aster');
    
    const view = (s) => ({
      "type": "col",
      "children": [
        {
          "type": "app_bar",
          "title": "Garden Tracker",
          "subtitle": "Barnyard Greens \u00b7 north beds",
          "children": [
            {
              "type": "badge",
              "text": "LIVE",
              "role": "success"
            }
          ]
        },
        {
          "type": "col",
          "gap": 4,
          "pad": 4,
          "grow": 1,
          "children": [
            {
              "type": "grid",
              "columns": 3,
              "gap": 4,
              "children": [
                {
                  "type": "card",
                  "gap": 2,
                  "children": [
                    {
                      "type": "stat",
                      "label": "Soil moisture",
                      "value": "41%"
                    },
                    {
                      "type": "sparkline",
                      "values": [
                        38,
                        40,
                        37,
                        42,
                        44,
                        41,
                        39,
                        41
                      ],
                      "role": "info"
                    }
                  ]
                },
                {
                  "type": "card",
                  "gap": 2,
                  "children": [
                    {
                      "type": "stat",
                      "label": "Greenhouse",
                      "value": "74\u00b0F"
                    },
                    {
                      "type": "meter",
                      "label": "Humidity",
                      "value": 62,
                      "role": "accent"
                    }
                  ]
                },
                {
                  "type": "card",
                  "gap": 2,
                  "children": [
                    {
                      "type": "stat",
                      "label": "Harvest this week",
                      "value": "18 lb"
                    },
                    {
                      "type": "status",
                      "text": "On track",
                      "role": "success"
                    }
                  ]
                }
              ]
            },
            {
              "type": "row",
              "gap": 4,
              "align": "start",
              "children": [
                {
                  "type": "panel",
                  "title": "Beds",
                  "subtitle": "watering schedule",
                  "grow": 1,
                  "children": [
                    {
                      "type": "meter",
                      "label": "Tomatoes",
                      "value": 0.8,
                      "role": "success"
                    },
                    {
                      "type": "meter",
                      "label": "Lettuce",
                      "value": 0.45,
                      "role": "warning"
                    },
                    {
                      "type": "meter",
                      "label": "Peppers",
                      "value": 0.2,
                      "role": "danger"
                    }
                  ]
                },
                {
                  "type": "panel",
                  "title": "Quick log",
                  "subtitle": "saved to your notes",
                  "grow": 1,
                  "children": [
                    {
                      "type": "input",
                      "key": "notes",
                      "placeholder": "What did you see today?"
                    },
                    {
                      "type": "switch",
                      "key": "auto_water",
                      "text": "Auto-water at dawn"
                    },
                    {
                      "type": "row",
                      "gap": 2,
                      "children": [
                        {
                          "type": "button",
                          "text": "Water now",
                          "action": "water",
                          "tone": "info"
                        },
                        {
                          "type": "button",
                          "text": "Save note",
                          "action": "save"
                        }
                      ]
                    }
                  ]
                }
              ]
            }
          ]
        }
      ]
    });
    
    app({ title: 'Garden Tracker', width: 900, height: 560, state: { notes: '', watered: 0 } })
      .view(view)
      .on('water', (s) => { s.watered++; })
      .on('save', (s) => { console.log('note:', s.notes); s.notes = ''; })
      .run();
    
  • tracker · JavaScript

    Habit tracker

    Tap "Done today" on each habit, see the week fill up, add new habits as you go.

    Copies a request to change it, the app's code and the Aster notes.

    View the source
    // Habit tracker: tap a habit when you do it; streaks and a weekly bar.
    const { app, col, row, grid, card, header, heading, stat, meter, button, input, pill, text, divider } = require('@barnyardgreens/aster');
    
    app({
      title: 'Habits', width: 960, height: 600, theme: 'paper_dark',
      state: {
        habits: [
          { name: 'Drink water', done: 5, goal: 7 },
          { name: 'Walk outside', done: 4, goal: 7 },
          { name: 'Read 20 min', done: 6, goal: 7 },
          { name: 'Stretch', done: 2, goal: 7 },
        ],
        newHabit: '',
      },
    })
      .view((s) =>
        col(
          header('Habits', 'this week', pill(`${s.habits.reduce((a, h) => a + h.done, 0)} check-ins`, 'success')),
          col({ gap: 4, pad: 4 },
            grid(2, { gap: 4 },
              ...s.habits.map((h, i) =>
                card({ gap: 2 },
                  row({ gap: 2, justify: 'space_between' }, heading(h.name, `${h.done} of ${h.goal} days`), button('Done today', (st) => { st.habits[i].done = Math.min(st.habits[i].goal, st.habits[i].done + 1); })),
                  meter('Progress', h.done / h.goal, { role: h.done >= h.goal ? 'success' : h.done / h.goal < 0.4 ? 'warning' : 'accent' })))),
            divider(),
            row({ gap: 2 },
              input('newHabit', 'Add a habit, like "Call a friend"', { grow: 1 }),
              button('Add', (st) => { if (st.newHabit.trim()) st.habits.push({ name: st.newHabit.trim(), done: 0, goal: 7 }); st.newHabit = ''; })))))
      .run();
    
  • tracker · C#

    Shopping list (C#)

    Add items, tick them off, remove them; the list is saved next to the app.

    Copies a request to change it, the app's code and the Aster notes.

    View the source
    // Shopping list: type an item, add it, tick it off. Saved to list.txt next to the app.
    using Aster;
    using static Aster.Ui;
    
    var file = Path.Combine(AppContext.BaseDirectory, "list.txt");
    var items = File.Exists(file) ? File.ReadAllLines(file).ToList() : ["Eggs", "Spinach", "Coffee beans", "Lemons"];
    var done = new HashSet<string> { "Eggs" };
    void Save() => File.WriteAllLines(file, items);
    
    var app = new AsterApp(new() { Title = "Shopping list", Width = 960, Height = 600, Theme = "light" });
    app.View(() => Col(
            Header("Shopping list", $"{items.Count - done.Count} left to get", Badge($"{done.Count} done", "success")),
            Col(
                Row(Input("item", "Add something, like \"Bread\"").Grow(),
                    Button("Add", () =>
                    {
                        var name = ((string?)app.Values["item"] ?? "").Trim();
                        if (name.Length > 0 && !items.Contains(name)) { items.Add(name); Save(); }
                        app.SetValues(new() { ["item"] = "" });
                    })).Gap(2),
                Card(items.Select(i => Row(
                        Text(done.Contains(i) ? $"✓ {i}" : i).Grow().Set("muted", done.Contains(i)),
                        Button(done.Contains(i) ? "Undo" : "Got it", () => { if (!done.Remove(i)) done.Add(i); }).Key($"got-{i}"),
                        Button("Remove", () => { items.Remove(i); done.Remove(i); Save(); }).Key($"rm-{i}").Tone("danger"))
                    .Gap(2)).ToArray()).Gap(2))
            .Gap(4).Pad(6)));
    app.Run();
    
  • kiosk · JavaScript

    Lobby kiosk

    A big, friendly welcome screen with a live clock and three large touch buttons.

    Copies a request to change it, the app's code and the Aster notes.

    View the source
    // Lobby kiosk: a big welcome screen with large touch buttons. Updates the clock every second.
    const { app, col, row, card, text, paragraph, button, status } = require('@barnyardgreens/aster');
    
    const now = () => new Date().toLocaleTimeString([], { hour: 'numeric', minute: '2-digit' });
    
    const kiosk = app({ title: 'Welcome', width: 960, height: 600, theme: 'paper_light', state: { time: now(), checkedIn: 0, message: '' } })
      .view((s) =>
        col({ gap: 6, pad: 8, grow: 1 },
          row({ gap: 4 }, text('Barnyard Greens', { style: 'title', bold: true, grow: 1 }), text(s.time, { style: 'title' })),
          col({ gap: 2, grow: 1, center: true },
            text('Welcome!', { style: 'display', bold: true }),
            paragraph('Tap below to check in. Someone will be right with you.', { style: 'title', muted: true })),
          row({ gap: 4 },
            card({ grow: 1, pad: 6 }, button('Check in', (st) => { st.checkedIn++; st.message = 'Thanks! You are checked in.'; }, { height: 72 })),
            card({ grow: 1, pad: 6 }, button('Pick up an order', (st) => { st.message = 'Your order will be out in a moment.'; }, { height: 72, tone: 'info' })),
            card({ grow: 1, pad: 6 }, button('Call for help', (st) => { st.message = 'Help is on the way.'; }, { height: 72, tone: 'warning' }))),
          s.message ? status(s.message, 'success') : text(`${s.checkedIn} visitors today`, { muted: true })));
    
    setInterval(() => kiosk.update((s) => { s.time = now(); }), 1000).unref();
    kiosk.run();
    
  • game menu · JavaScript

    Game title menu

    A title screen with a main menu, a news panel and a settings panel with volume and toggles.

    Copies a request to change it, the app's code and the Aster notes.

    View the source
    // Game menu: a title screen with a main menu and a settings panel.
    const { app, col, row, panel, text, button, toggle, slider, badge, caption } = require('@barnyardgreens/aster');
    
    app({ title: 'Swarm Fest', width: 960, height: 600, theme: 'high_contrast_dark', state: { screen: 'main', volume: 70, music: true, subtitles: false } })
      .view((s) =>
        row({ gap: 8, pad: 8, grow: 1, align: 'center' },
          col({ gap: 3, grow: 1 },
            row(badge('SEASON 2', 'warning')),
            text('SWARM FEST', { style: 'display', bold: true }),
            caption('Press a button to begin'),
            col({ gap: 2, width: 280 },
              button('Continue', (st) => { st.screen = 'main'; }),
              button('New game', (st) => { st.screen = 'main'; }, { tone: 'success' }),
              button('Settings', (st) => { st.screen = 'settings'; }, { tone: 'info' }),
              button('Quit', () => process.exit(0), { tone: 'danger' }))),
          s.screen === 'settings'
            ? panel('Settings', 'saved automatically', { width: 380 },
                text(`Volume ${s.volume}%`),
                slider('volume', 0, 100, 5),
                toggle('music', 'Music'),
                toggle('subtitles', 'Subtitles'),
                button('Back', (st) => { st.screen = 'main'; }, { ghost: true }))
            : panel('News', 'what is new', { width: 380 },
                text('New arena: The Hive'),
                text('Co-op for up to 4 players'),
                text('Controller support on every screen', { muted: true }))))
      .run();
    
  • photo wall · JavaScript

    Photo wall

    Every PNG in a folder as a grid of cards; open one to see it large.

    Copies a request to change it, the app's code and the Aster notes.

    View the source
    // Photo wall: every PNG in a folder as a grid of cards; click one to see it large.
    // Put your pictures (PNG) in a folder named "photos" next to this file.
    const fs = require('fs');
    const path = require('path');
    const { app, col, row, grid, card, header, image, text, button, badge, caption } = require('@barnyardgreens/aster');
    
    const folder = path.join(__dirname, 'photos');
    const photos = fs.existsSync(folder) ? fs.readdirSync(folder).filter((f) => f.toLowerCase().endsWith('.png')).sort() : [];
    const title = (f) => f.replace(/\.png$/i, '').replace(/[-_]+/g, ' ');
    
    app({ title: 'Photo Wall', width: 960, height: 600, state: { open: '' } })
      .view((s) =>
        col(
          header('Photo Wall', `${photos.length} pictures`, badge('PNG', 'info')),
          s.open
            ? col({ gap: 3, pad: 4, grow: 1 },
                image(path.join(folder, s.open), { fit: 'contain', grow: 1, alt: title(s.open) }),
                row({ gap: 2 }, text(title(s.open), { bold: true, grow: 1 }), button('Back to the wall', (st) => { st.open = ''; })))
            : grid(3, { gap: 4, pad: 4 },
                ...photos.map((f) =>
                  card({ gap: 2, align: 'stretch' },
                    image(path.join(folder, f), { fit: 'cover', height: 150, radius: 'md', alt: title(f) }),
                    row({ gap: 2 }, caption(title(f), { grow: 1 }), button('Open', (st) => { st.open = f; }, { ghost: true }))))),
        ))
      .run();
    
  • form · JavaScript

    Sign-up form

    Name, email, choices and a checked submit button; sign-ups are saved to a CSV file.

    Copies a request to change it, the app's code and the Aster notes.

    View the source
    // Sign-up form: text boxes, choices and a submit button that checks what was typed.
    const fs = require('fs');
    const { app, col, row, card, heading, input, checkbox, toggle, button, alert, text } = require('@barnyardgreens/aster');
    
    app({ title: 'Join the list', width: 960, height: 600, theme: 'light', state: { name: '', email: '', updates: true, sms: false, terms: false, result: '' } })
      .view((s) =>
        row({ pad: 8, grow: 1, center: true },
          card({ gap: 4, pad: 6, width: 520 },
            heading('Join the list', 'We send one email a month. No spam.'),
            input('name', 'Your name', { label: 'Name' }),
            input('email', '[email protected]', { label: 'Email' }),
            toggle('updates', 'Monthly updates'),
            toggle('sms', 'Text me when tickets go on sale'),
            checkbox('terms', 'I agree to the terms'),
            row({ gap: 2 },
              button('Sign up', (st) => {
                if (!st.name.trim()) st.result = 'Please type your name.';
                else if (!/^\S+@\S+\.\S+$/.test(st.email)) st.result = 'That email does not look right.';
                else if (!st.terms) st.result = 'Please agree to the terms.';
                else {
                  fs.appendFileSync('signups.csv', `${st.name},${st.email},${st.updates},${st.sms}\n`);
                  st.result = 'ok';
                }
              }),
              button('Clear', (st) => Object.assign(st, { name: '', email: '', terms: false, result: '' }), { ghost: true })),
            s.result === 'ok'
              ? alert('You are on the list', `Thanks, ${s.name}! Check ${s.email} for a hello.`, 'success')
              : s.result
                ? alert('Almost there', s.result, 'warning')
                : text('Saved to signups.csv on this computer.', { muted: true }))))
      .run();
    
  • starter · C#

    Counter (C#)

    The smallest Aster app in C#: a number and three buttons.

    Copies a request to change it, the app's code and the Aster notes.

    View the source
    // Counter: the smallest Aster app in C#. dotnet new console, dotnet add package Aster, paste this, dotnet run.
    using Aster;
    using static Aster.Ui;
    
    int count = 0;
    var app = new AsterApp(new() { Title = "Counter", Width = 960, Height = 600, Theme = "paper_dark" });
    app.View(() => Col(
            Text("You clicked").Style("title").Muted(),
            Text($"{count}").Style("display").Bold(),
            Text(count == 0 ? "Go on, try it." : count < 10 ? "Keep going!" : "That's a lot of clicks.").Muted(),
            Row(Button("Add one", () => count++),
                Button("Add ten", () => count += 10).Tone("info"),
                Button("Reset", () => count = 0).Tone("danger")).Gap(2))
        .Gap(3).Pad(8).Center().Grow());
    app.Run();
    

05 · Experimental · from branches not yet in a release

Everything at once.

Aster's cinematic layer, pushed as far as it goes: a shot that could sit in a film. aster-md, the editor from above, floats beside a black hole, and it is never still. The command palette opens and types a command, the table sorts itself in a wave, the checklist ticks off with a spring while its meter fills, a link preview floats in, the find ring jumps between matches, a line types itself and the attached file syncs, each piece on its own clock. Every five seconds the hole pulls, and the editor comes apart: lines break into runs of text, table rows into cells, list items into their boxes and words, and each bit goes on its own path, spinning, fluttering and curling. As its content goes the page buckles and tears into strips. Near the hole the bits stretch, redden and slow down, the lens bends the ones behind it into arcs and doubles, and they shed fibres and specks that spiral into the disk and spark where they cross it. A hand grabs the torn page and hauls it back, overshooting; the grab sends a shock ring through space and shakes the camera; the pieces fly home in reverse order, spring past their places and settle. Then the hole pulls again: three times in fifteen seconds.

This one is part Aster and part custom code, and the two are kept apart in the file. Aster can't bend light: its 3D lane sends rays in straight lines. So the hole, the disk, the stars and the pieces as surfaces in space come from a ray tracer written for this scene, in one self-contained module with one call; so do the glow off the orange accents, the shock rings and the heat shimmer. Aster draws every piece of the editor and animates it, runs the physics of the pull and the hand, and puts the film finish, a lens flare, the letterbox and the cursor on the traced picture. The scene script between them cuts the pieces up and moves the bits. The hand is real pointer input (move, press, drag, release) from the renderer's script, and the same inputs give the same bytes.

Event horizon: 15 s at 30 fps, a loop, 1920x1080 with a 2.39:1 picture inside, every frame rendered headless on the CPU by the file below and packed into H.264. With reduced motion on, it waits on a still frame with a play button.
The pull: the editor beside the black hole, its page and sidebar buckled into strips as their content breaks away; the checklist, the tip and the table header still cling on while chunks of text arc round the bright ring and orange sparks swirl inside the shadow.A close-up of the rescue: the cursor, closed into a glowing grip, hauls the torn page back, its strips fanned apart, while a chunk of paper tumbles toward the disk and sparks stream past it.A close-up of the black hole: chunks of the editor, stretched thin and pale, arc along the bright ring above the shadow and again below it, bent by the lens, while sparks and specks swirl inside.

What is custom code

  • A Schwarzschild ray tracer, in one module with one call: each ray is bent by the hole on its way out of the camera, so the disk's far side shows over and under the shadow, the stars fold into an Einstein ring, and a piece behind the hole shows up bent into arcs, sometimes twice.
  • The accretion disk: filaments that shear as they orbit, Doppler beaming that makes the approaching side brighter and bluer, and gravitational redshift near the horizon.
  • The editor's pieces as surfaces in space, each cut into chunks that tile it exactly at rest: paper with fibres and frosted glass, lit along their edges and torn edges by the disk, glinting and raked by its light as they fall, motion-blurred over a half-frame shutter, reddened and dimmed near the horizon, brighter as they rush toward the camera (Doppler, exaggerated).
  • The scene script: where the pull takes each chunk (into orbit, edge-on, stretched along the radius and thinned across it, spinning, fluttering and curling on its own clock), the order they let go in and come home in, the page tearing into strips, the spring past home, how slowly their clocks run deep in the well (time dilation, exaggerated so it shows), the shocks and camera shake, and the fibres, specks and sparks they shed, drawn as trails the lens does not bend.
  • Depth of field from the traced depth with focus following the page, a glow off the orange accents, heat shimmer and a colour fringe near the horizon, shock rings that ripple the picture, and the tone curve.

8,941 tokens of the file, in mod lens: plain Rust on every core, one call (lens::render) taking a scene of textured quads, sparks and a camera, so it can become an Aster effect later.

What is Aster

  1. UI every piece of the editor (top bar with find, file list, page, heading, typed line, pull quote, checklist and meter, tip, table, code block, attached file, link preview card, command palette), each its own app on its own clock, in aster-md's orange look and its faces (Segoe UI for the chrome, Calibri with Cambria headings for the page), drawn into a texture at twice the size it is seen at; and the lens flaremain @ 3006e4c51
  2. Kine the pieces as bodies on home springs, the pull that comes every five seconds, and the hand's grab and dragclaude/1x-kine-all + core, swarm, fields-tests @ 940875301
  3. Post the film finish: bloom, halation, anamorphic streaks, lens dirt, sharpening, cool and warm split tone, vignette, grainclaude/1x-cine-post @ adf34c668

8,602 tokens of the file, in mod editor, shown beside this. Merged locally onto aster-ui main 3006e4c51; the Kine and Post branches are not in a release.

What it costs

To write
1,660 lines of code, 26,670 tokens, for the whole file (o200k_base, the rule from section 01): Aster's part, the custom tracer, and the rest that places the pieces, scripts the hand and runs the frames
To draw a 1080p frame
10,731 ms median, 17,742 ms worst: the traced picture at four rays a pixel, then Aster redrawing the editor's 26 pieces and the finish, on a desktop CPU busy with other work. Not real time.
Film finish alone, cold full frame, 1080p
55-120 ms POST.md, Cost model

Most of the frame is the custom tracer. This is an offline render, the way film frames are made, not something an app draws at sixty frames a second.

What it found

  • A film finish (.post(..)) over an image kept showing the first picture after the picture changed: every frame came out the same. Here the image gets a new id each frame.
  • Kine's world is shared by every app on a thread. A second app made after the physics page stopped its timed pull, and drawing frames with it put the pieces back home. Here the editor's 26 pieces (each its own app, on its own clock) and the finish run on a second thread.
  • Aster's 3D lane can't bend light, which is why the hole is custom code. Its film finish took a picture from outside Aster as it was: bloom, streaks and grain sit on the traced frame as they would on a page.
asterv2_horizon.rs · the Aster part, lines 23-487 of 1877
mod editor {
    use aster_blueprint::ui::fx::post::{Grain, Halation, PostBloom, Streaks, Vignette};
    use aster_blueprint::ui::fx::post_color::Tone;
    use aster_blueprint::ui::kine::effect::kine_fx;
    use aster_blueprint::ui::kine::field::Vortex;
    use aster_blueprint::ui::kine::swarm_draw::swarm_layer;
    use aster_blueprint::ui::kine::{Body, V2};
    use aster_blueprint::ui::prelude::*;

    fn c(rgb: u32) -> Col {
        hex(rgb).into()
    }
    const INK: u32 = 0x1f2328;
    const MUTED: u32 = 0x6b6f76;
    const ACCENT: u32 = 0xff5a1f;
    const GREEN: u32 = 0x2f9e5b;
    const AMBER: u32 = 0xc98a1c;
    pub const PAPER: [u8; 3] = [251, 248, 242];
    fn paper() -> Col {
        rgba(PAPER[0], PAPER[1], PAPER[2], 255).into()
    }
    fn ease(x: f64) -> f64 {
        let x = x.clamp(0., 1.);
        x * x * (3. - 2. * x)
    }
    /// aster-md's faces: Segoe UI for the chrome (registered as the kit's `ui` and `bold`) and the Report pairing for
    /// the document: Calibri, with Cambria headings. [`FACES`] lists the files; the pieces name the roles.
    pub const FACES: [(&str, &str); 6] = [("ui", "segoeui.ttf"), ("bold", "seguisb.ttf"), ("p4", "calibri.ttf"), ("p4-b", "calibrib.ttf"), ("p4-i", "calibrii.ttf"), ("p4-h", "cambriab.ttf")];
    /// Document text in one Report face.
    fn doc(s: &str, px: f64, face: &str, col: u32) -> El {
        rich([span(s).font(face)]).font_px(px).color(c(col))
    }
    fn t13(s: &str) -> El {
        doc(s, 15., "p4", INK)
    }

    /// What a piece is made of, for the light: frosted glass (chrome, sidebar) or paper (the page and everything on it).
    #[derive(Clone, Copy, PartialEq)]
    pub enum Kind {
        Glass,
        Paper,
    }
    /// One piece of the window: id, material, the piece it sits on, its box in window px, and whether it animates.
    pub struct Piece {
        pub id: &'static str,
        pub kind: Kind,
        pub parent: Option<usize>,
        pub rect: [f64; 4],
        pub live: bool,
    }
    const fn p(id: &'static str, kind: Kind, parent: Option<usize>, rect: [f64; 4], live: bool) -> Piece {
        Piece { id, kind, parent, rect, live }
    }
    use Kind::{Glass, Paper};
    /// The window, 920 x 760 px: chrome, sidebar with four files, and the page with its blocks; last, two pieces that
    /// float over the page now and then (a link preview card and the command palette).
    pub const PIECES: [Piece; 26] = [
        p("chrome", Glass, None, [0., 0., 920., 40.], true),
        p("sidebar", Glass, None, [0., 40., 204., 720.], false),
        p("file.0", Glass, Some(1), [8., 66., 188., 44.], true),
        p("file.1", Glass, Some(1), [8., 132., 188., 44.], true),
        p("file.2", Glass, Some(1), [8., 180., 188., 44.], true),
        p("file.3", Glass, Some(1), [8., 228., 188., 44.], true),
        p("page", Paper, None, [226., 52., 680., 760.], false),
        p("h1", Paper, Some(6), [262., 80., 608., 48.], true),
        p("line.0", Paper, Some(6), [262., 136., 608., 22.], false),
        p("line.1", Paper, Some(6), [262., 158., 608., 22.], true),
        p("quote", Paper, Some(6), [262., 188., 608., 56.], true),
        p("meter", Paper, Some(6), [262., 252., 608., 44.], true),
        p("check.0", Paper, Some(6), [262., 298., 608., 22.], true),
        p("check.1", Paper, Some(6), [262., 322., 608., 22.], true),
        p("check.2", Paper, Some(6), [262., 346., 608., 22.], true),
        p("check.3", Paper, Some(6), [262., 370., 608., 22.], true),
        p("tip", Paper, Some(6), [262., 398., 608., 44.], true),
        p("thead", Paper, Some(6), [262., 450., 608., 26.], true),
        p("row.0", Paper, Some(6), [262., 476., 608., 24.], false),
        p("row.1", Paper, Some(6), [262., 500., 608., 24.], false),
        p("row.2", Paper, Some(6), [262., 524., 608., 24.], false),
        p("row.3", Paper, Some(6), [262., 548., 608., 24.], false),
        p("code", Paper, Some(6), [262., 580., 608., 108.], true),
        p("embed", Paper, Some(6), [262., 696., 608., 44.], true),
        p("hover", Paper, Some(6), [540., 166., 330., 84.], true),
        p("palette", Glass, Some(6), [300., 64., 480., 180.], true),
    ];
    /// The table's rows (material, weight, opacity, price) and the two orders it sorts between: by name, by price.
    pub const ROWS: [(&str, &str, &str, &str); 4] = [("Cotton bond", "100", "94%", "$18.50"), ("Laid paper", "90", "91%", "$21.00"), ("Vellum", "110", "62%", "$26.75"), ("Slate card", "300", "100%", "$34.20")];
    pub const BY_PRICE: [usize; 4] = [3, 2, 1, 0];

    /// The table is sorted by price during this part of its 5 s cycle (the palette's command sorts it).
    pub fn sorted_by_price(tau: f64) -> bool {
        (0.35..4.2).contains(&tau.rem_euclid(5.))
    }
    /// When checklist item `k` is ticked in the 5 s cycle (they clear as the pieces come home).
    fn tick_at(k: usize) -> f64 {
        0.15 + 0.14 * k as f64
    }
    fn ticked(tau: f64, k: usize) -> bool {
        let ph = tau.rem_euclid(5.);
        ph >= tick_at(k) && ph < 4.75
    }
    /// A spring from 0 to 1 that overshoots and rings down (0 before `t` = 0).
    fn spring(t: f64) -> f64 {
        if t <= 0. { 0. } else { 1. - (-6. * t).exp() * (13. * t).cos() }
    }
    /// The command palette: it opens as the hand rests on Commands, its query types itself, and it closes as the pull starts.
    pub fn palette_open(tau: f64) -> f64 {
        let ph = tau.rem_euclid(5.);
        spring(ph - 0.06) * (1. - ease((ph - 0.6) / 0.14))
    }
    /// The link preview card: it floats in over the page, and fades once the pull has taken it.
    pub fn hover_open(tau: f64) -> f64 {
        let ph = tau.rem_euclid(5.);
        spring(ph - 0.3) * (1. - ease((ph - 3.3) / 0.4))
    }
    /// Find: which of the three matches of "page" the ring is on, and how far it has popped in there.
    fn find_at(tau: f64) -> (usize, f64) {
        let x = tau / 0.9;
        (x.floor().rem_euclid(3.) as usize, 1. - (-12. * x.fract() * 0.9).exp())
    }
    /// A word with the find ring round it (`on`: 0 = no ring).
    fn hit(word: &str, face: &str, px: f64, on: f64) -> El {
        doc(word, px, face, INK).pad_px(2.).radius_px(4.).fill(rgba(255, 90, 31, (50. * on) as u8)).border_px(rgba(255, 90, 31, (235. * on) as u8), 1.5)
    }

    /// How a piece comes apart: along its width (`true`) or down its height, at these fractions. Lines break into runs of
    /// text, table rows into cells, a checklist item into its box and its words, the page and sidebar into strips.
    pub fn cuts(id: &str) -> (bool, &'static [f64]) {
        const CELLS: [f64; 5] = [0., 0.43, 0.625, 0.805, 1.];
        match id {
            "chrome" | "line.0" | "line.1" => (true, &[0., 0.17, 0.33, 0.5, 0.66, 0.83, 1.]),
            "sidebar" | "palette" => (false, &[0., 0.2, 0.4, 0.6, 0.8, 1.]),
            "page" => (false, &[0., 0.1, 0.2, 0.3, 0.4, 0.5, 0.6, 0.7, 0.8, 0.9, 1.]),
            "h1" | "meter" | "tip" | "embed" => (true, &[0., 0.25, 0.5, 0.75, 1.]),
            "quote" | "code" => (true, &[0., 0.2, 0.4, 0.6, 0.8, 1.]),
            "hover" => (true, &[0., 0.33, 0.66, 1.]),
            "thead" => (true, &CELLS),
            _ if id.starts_with("row.") => (true, &CELLS),
            _ if id.starts_with("check.") => (true, &[0., 0.035, 0.33, 0.66, 1.]),
            _ if id.starts_with("file.") => (true, &[0., 0.22, 1.]),
            _ => (true, &[0., 1.]),
        }
    }

    /// The face of piece `id` at its own time `tau`, drawn by Aster into the piece's texture. `hover` is how close the
    /// hand rests to the command button.
    pub fn face(id: &str, tau: f64, hover: f64) -> El {
        let ph5 = tau.rem_euclid(5.);
        let ph15 = tau.rem_euclid(15.);
        let blink = (tau * 2.).rem_euclid(2.) < 1.2;
        match id {
            "chrome" => {
                let typing = (0.3..3.1).contains(&ph5);
                let pulse = 0.5 + 0.5 * (tau * std::f64::consts::TAU / 1.25).sin();
                let (label, role) = if typing { ("Saving", AMBER) } else { ("Saved", GREEN) };
                let dot = overlay([]).size(7., 7.).round().fill(c(role));
                let halo = overlay([]).size(13., 13.).round().fill(rgba(47, 158, 91, (40. + 60. * pulse) as u8));
                let pill = row([overlay([halo, dot.place(Align::Center, Align::Center)]).size(13., 13.), text(label).font_px(11.5).color(c(role))]).gap(1).pad_xy(2, 1).radius(Radius::Full).fill(rgba(47, 158, 91, 28));
                let crumb = |s: &str| text(s).font_px(12.5).color(c(MUTED));
                let chev = || icon(Icon::ChevronRight).size(11).color(c(0xa0a4ab)).el();
                let key = |k: &str| text(k).font_px(11.).bold().color(c(INK)).pad_xy(1, 0).radius(Radius::Sm).fill(rgba(255, 255, 255, (200. + 55. * hover) as u8)).border(rgba(255, 90, 31, (40. + 180. * hover) as u8));
                let (m, _) = find_at(tau);
                let find = row([text("Find").font_px(11.5).color(c(MUTED)), text("page").font_px(11.5).bold().color(c(INK)), text(format!("{} of 3", m + 1)).font_px(11.).color(c(ACCENT))]).gap(1).pad_xy(2, 1).radius(Radius::Md).fill(rgba(0, 0, 0, 12));
                let cmds = row([text("Commands").font_px(12.).color(if hover > 0.5 { c(ACCENT) } else { c(MUTED) }), key("Ctrl"), key("K")]).gap(1).pad_xy(2, 1).radius(Radius::Md).fill(rgba(255, 90, 31, (36. * hover) as u8));
                row([icon(Icon::Menu).size(16).color(c(MUTED)).el(), crumb("aster-md"), chev(), crumb("notes"), chev(), text("field-notes.md").font_px(12.5).bold().color(c(INK)), pill, overlay([]).grow(1.), find, cmds])
                    .gap(2)
                    .align(Align::Center)
                    .pad_xy(4, 0)
                    .size(920., 40.)
                    .gradient(rgba(248, 244, 236, 238), rgba(240, 235, 226, 232))
                    .border_px(rgba(255, 255, 255, 200), 1.)
                    .radius_px(10.)
            }
            "sidebar" => col([
                text("PINNED").font_px(10.5).bold().color(c(MUTED)),
                overlay([]).h(44.),
                text("RECENT").font_px(10.5).bold().color(c(MUTED)),
                overlay([]).grow(1.),
                row([icon(Icon::Folder).size(14).color(c(MUTED)).el(), text("Open file").font_px(12.).color(c(INK)), overlay([]).grow(1.), text("Ctrl O").font_px(11.).color(c(MUTED))]).gap(2).align(Align::Center),
            ])
            .gap(2)
            .pad_px(12.)
            .size(204., 720.)
            .gradient(rgba(244, 240, 233, 214), rgba(236, 231, 223, 206))
            .border_px(rgba(255, 255, 255, 170), 1.)
            .radius_px(10.),
            _ if id.starts_with("file.") => {
                let k: usize = id[5..].parse().unwrap_or(0);
                let (name, when) = [("field-notes.md", "now"), ("sample.md", "2m"), ("bigtable.md", "1h"), ("huge.md", "Tue")][k];
                let lit = (ph15 / 3.75) as usize % 4 == k;
                let badge = text("MD").font_px(9.5).bold().color(c(if k == 0 { ACCENT } else { MUTED })).pad_xy(1, 1).radius(Radius::Sm).fill(rgba(255, 90, 31, if k == 0 { 40 } else { 18 }));
                let names = col([text(name).font_px(13.).color(c(INK)).bold(), text("D:/notes/2026").font_px(10.5).color(c(MUTED))]).gap_px(1.);
                row([badge, names, overlay([]).grow(1.), text(when).font_px(10.5).color(c(MUTED))])
                    .gap(2)
                    .align(Align::Center)
                    .pad_xy(2, 1)
                    .size(188., 44.)
                    .radius_px(8.)
                    .fill(if k == 0 { rgba(255, 90, 31, 46) } else if lit { rgba(30, 35, 45, 18) } else { rgba(0, 0, 0, 0) })
                    .border_px(if lit { rgba(255, 90, 31, 90) } else { rgba(0, 0, 0, 0) }, 1.)
            }
            "page" => overlay([]).size(680., 760.).fill(paper()),
            "h1" => col([doc("Field notes", 30., "p4-h", INK), overlay([]).h(1.).w(608. * (0.6 + 0.4 * ease(ph15 / 2.))).fill(c(0xd8d2c6))]).gap(2).size(608., 48.).fill(paper()),
            "line.0" => {
                let (m, k) = find_at(tau);
                let lit = hover_open(tau).clamp(0., 1.);
                let link = col([rich([span("config.md").mono()]).font_px(15.).color(if lit > 0.3 { c(ACCENT) } else { c(INK) }), overlay([]).h(1.).w(81.).fill(rgba(255, 90, 31, (220. * lit) as u8))]);
                row([doc("This", 15., "p4", INK), hit("page", "p4", 15., if m == 0 { k } else { 0. }), rich([span("is the whole app: one ").font("p4"), span("document").font("p4-b"), span(", rendered as you type it, in").font("p4")]).font_px(15.).color(c(INK)), link])
                    .gap_px(4.)
                    .align(Align::Center)
                    .size(608., 22.)
                    .fill(paper())
            }
            "line.1" => {
                let full = "Everything on this page is live, and all of it can fall.";
                let n = full.chars().count();
                let shown = if ph5 < 4.4 { ((ph5 - 0.3) / 2.8).clamp(0., 1.) * n as f64 } else { n as f64 };
                let typed: String = full.chars().take(shown as usize).collect();
                let sel = (4.4..4.75).contains(&ph5);
                let caret = overlay([]).size(1.6, 16.).fill(if blink || (0.3..3.1).contains(&ph5) { c(ACCENT) } else { rgba(0, 0, 0, 0).into() });
                let body = if ph5 >= 4.75 { t13("") } else { t13(&typed) };
                let body = if sel { body.fill(rgba(255, 90, 31, 60)) } else { body };
                row([body, caret]).gap_px(1.).align(Align::Center).size(608., 22.).fill(paper())
            }
            "quote" => {
                let sweep = ease(ph5 / 2.5);
                col([
                    row([doc("\u{201c}", 36., "p4-h", ACCENT), row([doc("The best interface disappears into the work, leaving the", 16.5, "p4-i", INK), hit("page.", "p4-i", 16.5, { let (m, k) = find_at(tau); if m == 1 { k } else { 0. } })]).gap_px(4.).align(Align::Center)]).gap(3).align(Align::Center),
                    row([overlay([]).w(40.), overlay([]).h(1.5).w(560. * sweep).gradient_h(c(ACCENT), rgba(255, 90, 31, 0))]),
                ])
                .gap(1)
                .size(608., 56.)
                .fill(paper())
            }
            "meter" => {
                let done = (0..4).filter(|&k| ticked(tau, k)).count();
                // The bar springs to each new value: an overshoot that rings down after every tick.
                let mut last_change = -99.;
                let mut prev = 0.;
                for k in 0..4 {
                    let on = tick_at(k);
                    if ph5 >= on && ph5 < 4.75 {
                        last_change = on;
                        prev = k as f64 / 4.;
                    }
                }
                if ph5 >= 4.75 {
                    last_change = 4.75;
                    prev = 1.;
                }
                let target = done as f64 / 4.;
                let dt = ph5 - last_change;
                let fill = (target - (target - prev) * (-5. * dt).exp() * (14. * dt).cos()).clamp(0., 1.04);
                let bar = overlay([overlay([]).size(260., 6.).radius(Radius::Full).fill(c(0xe4dfd4)), overlay([]).size(260. * fill, 6.).radius(Radius::Full).gradient_h(c(0xff8a5c), c(ACCENT))]);
                col([doc("Launch checklist", 19., "p4-h", INK), row([bar, doc(&format!("{done} of 4 done"), 12.5, "p4-b", MUTED), doc(&format!("{}%", (fill * 100.).round().min(100.)), 12., "p4", MUTED)]).gap(3).align(Align::Center)])
                    .gap(2)
                    .size(608., 44.)
                    .fill(paper())
            }
            _ if id.starts_with("check.") => {
                let k: usize = id[6..].parse().unwrap_or(0);
                let label = ["Paper stock chosen", "Tables sort and filter", "Typography panel", "Cinematic motion clip"][k];
                let on = ticked(tau, k);
                // The box pops when it is ticked: a spring from small through too big to its size.
                let dt = tau.rem_euclid(5.) - tick_at(k);
                let pop = if on { 1. - 0.45 * (-8. * dt).exp() * (18. * dt).cos() } else { 1. };
                let boxed = col(if on { vec![icon(Icon::Check).size(11).color(c(0xffffff)).el()] } else { vec![] })
                    .size(15. * pop, 15. * pop)
                    .centered()
                    .radius_px(3.)
                    .fill(if on { c(ACCENT) } else { rgba(255, 255, 255, 255).into() })
                    .border_px(if on { c(ACCENT) } else { c(0x8a8f98) }, 1.2);
                let label = doc(label, 15., "p4", if on { MUTED } else { INK });
                row([col([boxed]).size(19., 19.).centered(), label]).gap(1).align(Align::Center).size(608., 22.).fill(paper())
            }
            "tip" => {
                let glow = 0.5 + 0.5 * (tau * std::f64::consts::TAU / 2.5).sin();
                row([
                    overlay([]).w(3.).h(44.).fill(c(GREEN)),
                    col([row([icon(Icon::CheckCircle).size(13).color(rgba(47, 158, 91, (150. + 105. * glow) as u8)).el(), doc("Tip", 13., "p4-b", GREEN)]).gap(1).align(Align::Center), row([t13("Drag a table row to reorder it; the"), hit("page", "p4", 15., { let (m, k) = find_at(tau); if m == 2 { k } else { 0. } }), t13("keeps the change.")]).gap_px(4.).align(Align::Center)]).gap(1).pad_xy(3, 1),
                ])
                .size(608., 44.)
                .fill(rgba(234, 245, 238, 255))
            }
            "thead" => {
                let by_price = sorted_by_price(tau);
                let arrow = |on: bool| if on { icon(Icon::ArrowDown).size(11).color(c(ACCENT)).el() } else { overlay([]).w(11.) };
                let head = |s: &str, w: f64, on: bool| row([doc(s, 13., "p4-b", INK), arrow(on)]).gap(1).w(w).align(Align::Center);
                row([head("Material", 248., !by_price), head("Weight (gsm)", 120., false), head("Opacity", 110., false), head("Price", 100., by_price)])
                    .pad_xy(3, 0)
                    .align(Align::Center)
                    .size(608., 26.)
                    .fill(rgba(241, 237, 229, 255))
                    .border_px(c(0xddd6c8), 1.)
            }
            _ if id.starts_with("row.") => {
                let k: usize = id[4..].parse().unwrap_or(0);
                let (m, w, o, pr) = ROWS[k];
                let cell = |s: &str, wd: f64| doc(s, 14.5, "p4", INK).w(wd);
                row([cell(m, 248.), cell(w, 120.), cell(o, 110.), cell(pr, 100.)]).pad_xy(3, 0).align(Align::Center).size(608., 24.).fill(if k % 2 == 1 { rgba(246, 242, 234, 255) } else { paper() }).border_px(c(0xebe5da), 1.)
            }
            "code" => {
                let lines: [&[(&str, u32)]; 5] = [
                    &[("/// Merge two sorted runs, newest wins.", 0x8a8f98)],
                    &[("pub fn ", 0x8a3ffc), ("compact", 0x1f6feb), ("(a: &[Entry], b: &[Entry]) -> Vec<Entry> {", INK)],
                    &[("    let ", 0x8a3ffc), ("mut ", 0x8a3ffc), ("out = Vec::with_capacity(a.len() + b.len());", INK)],
                    &[("    merge", 0x1f6feb), ("(a, b, &mut out);", INK)],
                    &[("    out", INK), (" }", INK)],
                ];
                let hl = (tau / 1.25) as usize % 5;
                let rows = lines.iter().enumerate().map(|(i, segs)| {
                    let gutter = text(format!("{}", i + 1)).font_px(11.).mono().color(c(0xa0a4ab)).w(22.);
                    let code = rich(segs.iter().map(|(s, col)| span(*s).mono().color(c(*col)))).font_px(12.);
                    row([gutter, code]).gap(1).align(Align::Center).h(16.).fill(if i == hl { rgba(255, 90, 31, 26) } else { rgba(0, 0, 0, 0) })
                });
                let bar = row([text("RUST").font_px(9.5).bold().color(c(MUTED)).pad_xy(1, 0).radius(Radius::Sm).fill(rgba(0, 0, 0, 14)), overlay([]).grow(1.), text("Copy").font_px(10.5).color(c(MUTED))]).align(Align::Center);
                col([bar, col(rows.collect::<Vec<_>>()).gap_px(0.)]).gap(1).pad_xy(3, 2).size(608., 108.).fill(rgba(246, 244, 240, 255)).border_px(c(0xe2ddd2), 1.).radius_px(6.)
            }
            "embed" => {
                let sync = (tau / 2.5).rem_euclid(1.);
                let bar = overlay([overlay([]).size(120., 4.).radius(Radius::Full).fill(c(0xe4dfd4)), overlay([]).size(120. * sync, 4.).radius(Radius::Full).fill(c(ACCENT))]);
                row([
                    col([icon(Icon::File).size(16).color(c(0xffffff)).el()]).size(30., 30.).centered().radius_px(6.).fill(c(0xd9534f)),
                    col([doc("rollout-notes.pdf", 13.5, "p4-b", INK), doc("PDF · 2.4 MB · embedded", 11.5, "p4", MUTED)]).gap_px(1.),
                    overlay([]).grow(1.),
                    col([doc(&format!("Syncing {}%", (sync * 100.) as u32), 11.5, "p4", MUTED), bar]).gap(1).align(Align::End),
                ])
                .gap(2)
                .align(Align::Center)
                .pad_xy(3, 1)
                .size(608., 44.)
                .fill(rgba(255, 255, 255, 255))
                .border_px(c(0xe2ddd2), 1.)
                .radius_px(8.)
            }
            "hover" => col([
                row([doc("config.md", 14., "p4-b", INK), overlay([]).grow(1.), text("LINK").font_px(9.5).bold().color(c(ACCENT)).pad_xy(1, 0).radius(Radius::Sm).fill(rgba(255, 90, 31, 30))]).align(Align::Center),
                doc("Page settings: paper stock, theme and type.", 12.5, "p4", MUTED),
                row([overlay([]).size(46., 6.).radius(Radius::Full).fill(c(0xe4dfd4)), overlay([]).size(80., 6.).radius(Radius::Full).fill(c(0xe4dfd4)), overlay([]).size(60., 6.).radius(Radius::Full).fill(rgba(255, 90, 31, 130))]).gap(1),
            ])
            .gap(1)
            .pad_px(12.)
            .size(330., 84.)
            .fill(rgba(255, 255, 255, 255))
            .border_px(c(0xe2ddd2), 1.)
            .radius_px(10.),
            "palette" => {
                let ph = tau.rem_euclid(5.);
                let query = "sort table by price";
                let n = query.chars().count() as f64;
                let typed: String = query.chars().take((((ph - 0.1) / 0.3).clamp(0., 1.) * n) as usize).collect();
                let pick = (((ph - 0.12) / 0.11).max(0.) as usize).min(3);
                let item = |k: usize, label: &str, keys: &str| {
                    row([text(label).font_px(13.).color(c(INK)), overlay([]).grow(1.), text(keys).font_px(11.).color(c(MUTED))])
                        .align(Align::Center)
                        .pad_xy(3, 0)
                        .h(28.)
                        .radius_px(6.)
                        .fill(if k == pick { rgba(255, 90, 31, 44) } else { rgba(0, 0, 0, 0) })
                };
                col([
                    row([text("\u{203a}").font_px(18.).bold().color(c(ACCENT)), text(typed).font_px(14.).color(c(INK)), overlay([]).size(1.5, 16.).fill(c(ACCENT))]).gap(1).align(Align::Center).h(30.),
                    overlay([]).h(1.).fill(rgba(0, 0, 0, 24)),
                    item(0, "Sort table by price", "Ctrl Shift S"),
                    item(1, "Find in document", "Ctrl F"),
                    item(2, "Change paper stock", ""),
                    item(3, "Export as PDF", "Ctrl E"),
                ])
                .gap_px(2.)
                .pad_px(12.)
                .size(480., 180.)
                .gradient(rgba(250, 247, 241, 246), rgba(242, 238, 230, 240))
                .border_px(rgba(255, 90, 31, 90), 1.)
                .radius_px(12.)
            }
            _ => overlay([]),
        }
    }

    /// The physics page: one stand-in body per piece (light ones near the hole, the page furthest out, so they come loose
    /// one at a time), and the pull, a vortex every 5 s. Each body's offset becomes its piece's fall.
    pub fn physics(st: &Store) -> El {
        let _ = st.int("tick");
        let bodies = SLOTS.iter().enumerate().map(|(i, s)| {
            let (w, h) = (s.2, s.3);
            let body = overlay([]).size(w, h).id(format!("b{i}").as_str()).draggable_body(Body::new().mass(s.4).home(24., 0.75).restitution(0.2).friction(0.5).squash(0.3));
            col([overlay([]).h(s.1 - h / 2.), row([overlay([]).w(s.0 - w / 2.), body])]).place(Align::Start, Align::Start)
        });
        let pull = Vortex { spin: 5., ..Vortex::new(V2::ZERO).strength(4200.).radii(130., 780.).pull(7000.).life(4.).fade(2., 0.6) };
        let core = overlay([]).size(4., 4.).place(Align::Center, Align::Center).id("hole").emits(pull, 5000);
        let mut kids: Vec<El> = bodies.collect();
        kids.extend([core, swarm_layer().el(), kine_fx()]);
        overlay(kids)
    }
    /// The order the pieces come loose in (0 first): the preview card and the palette, sidebar files, lines of text, list
    /// items, table rows, then the blocks, the chrome, the sidebar, and the page last.
    pub const RANK: [usize; 26] = [22, 23, 2, 3, 4, 5, 25, 16, 6, 7, 17, 18, 8, 9, 10, 11, 19, 20, 12, 13, 14, 15, 21, 24, 0, 1];
    /// Stand-in bodies, by piece: centre x, y on the 1280 x 720 physics page, size, mass.
    pub const SLOTS: [(f64, f64, f64, f64, f64); 26] = [
        (640., 40., 260., 30., 4.),
        (110., 360., 90., 160., 5.),
        (470., 250., 60., 30., 1.2),
        (820., 470., 60., 30., 1.3),
        (450., 470., 60., 30., 1.4),
        (840., 250., 60., 30., 1.5),
        (1150., 360., 150., 200., 7.),
        (640., 560., 120., 40., 2.6),
        (380., 360., 70., 26., 1.2),
        (900., 360., 70., 26., 1.3),
        (300., 170., 120., 40., 2.8),
        (980., 560., 110., 40., 2.7),
        (640., 210., 70., 26., 1.4),
        (640., 520., 70., 26., 1.5),
        (380., 300., 70., 26., 1.6),
        (900., 420., 70., 26., 1.7),
        (980., 170., 120., 40., 2.9),
        (300., 560., 120., 30., 2.6),
        (560., 280., 70., 26., 1.5),
        (720., 440., 70., 26., 1.6),
        (560., 440., 70., 26., 1.7),
        (720., 280., 70., 26., 1.8),
        (300., 640., 140., 50., 3.4),
        (980., 650., 130., 40., 3.2),
        (760., 200., 100., 40., 1.0),
        (520., 160., 140., 60., 1.1),
    ];

    /// The frame: the traced picture under Aster's film finish and a lens flare on the disk's bright side, in a 2.39:1
    /// letterbox, with the hand on top. `n` (the frame number) keys the picture so the finish redraws it every frame.
    pub fn frame(pic: &Picture, hand: [f64; 3], n: i64, flare: [f64; 2]) -> El {
        // The picture comes in tone-mapped (the tracer has its own curve), so the grade only tints: cool shadows, warm
        // highlights. Thresholds sit above the paper so the page stays clean; the disk blooms.
        let film = Post::new()
            .bloom(PostBloom { threshold: 0.98, knee: 0.06, strength: 0.7, spread: 0.7, levels: 6, tint: [1., 0.9, 0.78] })
            .halation(Halation { threshold: 0.97, radius: 16., strength: 0.32, tint: [1., 0.3, 0.08] })
            .streaks(Streaks { threshold: 0.97, length: 320., strength: 0.24, tint: [0.45, 0.62, 1.] })
            .dirt(0.3)
            .tone(Tone::None, 0.)
            .split_tone([0.32, 0.52, 0.66], 0.1, [1., 0.74, 0.46], 0.12)
            .vignette(Vignette { strength: 0.42, size: 0.45, roundness: 0.6, smoothness: 0.75 })
            .grain(Grain { strength: 0.011, size: 1., animate: true, seed: 3 })
            .sharpen(0.35)
            .dither(true);
        let flare = lens_flare(Flare::new().at(flare[0], flare[1]).color(rgba(255, 214, 160, 255)).intensity(0.22).streak(0.8).ghosts(0));
        let bar = || overlay([]).h(92.33).fill(rgba(0, 0, 0, 255));
        let shot = overlay([image(pic).size(1280., 535.34).id(format!("shot.{n}").as_str()), flare.cover()]).size(1280., 535.34).post(film);
        overlay([col([bar(), shot, bar()]).fill(rgba(0, 0, 0, 255)), cursor(hand)])
    }

    /// The hand: an arrow pointer that closes into a glowing grip while it holds a piece.
    fn cursor([x, y, grip]: [f64; 3]) -> El {
        canvas(move |_, _, _| {
            let arrow = [[0., 0.], [0., 26.], [7., 20.], [12., 31.], [17., 29.], [12., 18.], [21., 18.]];
            let s = 1. - 0.15 * grip;
            let pts: Vec<[f64; 2]> = arrow.iter().map(|p| [x + p[0] * s, y + p[1] * s]).collect();
            let mut v = vec![];
            if grip > 0.01 {
                v.push(Shape::circle(x, y, 16. + 6. * grip).fill(rgba(255, 210, 140, (70. * grip) as u8)));
                v.push(Shape::circle(x, y, 9.).stroke(rgba(255, 236, 200, (230. * grip) as u8), 2.5));
            }
            v.push(Shape::polygon(&pts).fill(c(0xffffff)).stroke(c(0x10131c), 1.6));
            v
        })
        .grow(1.)
    }
}

Download the whole file (1877 lines: this part, the custom ray tracer, and the script that places the pieces, moves the hand and wrote the frames)

About the numbers and pictures

aster-md's numbers, the real-app example, are from its own repository: the engine benchmark (bench/README.md), the production notes (PRODUCTION.md), the app's README and one real-window run, all on a fast desktop, with the busy-laptop rows pinned to one core beside two spinning threads. Its pictures are headless renders by the app, which is in development.

Tokens are from the token pairs' receipts and the same counting script, which also counted aster-md's sources. Aster's frame times are from the aster-ui repository's optimisation log (OPT-BUILD.md), the GPU plugin's README and loop measurements of runtime 0.1.0 on a busy 96-thread server; each says what was measured beside it. The finale's frame time and token count were measured for this page.

The token pair pictures are reused from the earlier Aster pages. The finale pictures and clip are new, rendered on the CPU from the file shown, which is partly custom code, as the finale says. All data is made up.

Made for fun.

See the work

A record of what gets built at home with AI coding agents, and how.