Lantern Ballet
The model widens the palette, you choose. System Two writes three new movements for twelve lanterns, the code checks that each can be danced, and only the artist picks one.
What it shows
The model proposes; the person chooses. Asked for a movement nobody listed, System Two writes three (generate with n: 3). The code checks each one before it is offered, the stage draws every offer on its own, and lets the lanterns dance one before it is picked, and nobody but the artist picks (ask: ['human']): there is no judge, no right answer, and the lanterns keep orbiting until the artist has chosen.
Why this scenario. On the greeting card the possibilities are written in code and System One picks among them: the model narrows. Here the model widens: it writes options the code never listed, and taste stays with the person. That is the shape of most creative tools: the model suggests what the artist would not have thought of, and the artist answers for what is performed. A movement is a few numbers in a space the code chose, so every offer can be checked and drawn before anyone commits to it.
| You will see | What does it |
|---|---|
| invent: three named movements, each drawn in its own card | generate(…, { n: 3 }): System Two's candidates, tagged by kind |
| An offer that would not close or would leave the stage is never shown | check on each candidate |
| The lanterns orbit until you pick | ask: ['human'], no judge: the question is the artist's |
| Pointing at a card, the lanterns dance it; nothing is decided | intent.preview for each candidate |
| A mood asks System Two for three new movements; undo brings back your pick | tell and forget in one commit; results kept per mood |
| A held material stays when the movement changes; Release material lets go | The movement's prior, an artist's decision above it |
| Pause, tempo and reduced motion change the performance, not the score | λ is data, the host performs it |
Learn more: Generating candidates, A result that won't do, A person's decision, A possible card from code, Catalogs.
Where it fits: design and creative tools where a model sketches alternatives and a person picks (motion, lighting, layout, palettes, music); anywhere the model's output must be checked and seen before it is used.
Choose a movement
Twelve lanterns dance an orbit, a tide or a bloom, written in code. Choose invent: System Two writes three movements, each drawn in a small card of its own colour, and the lanterns keep orbiting. Point at a card and the lanterns dance it, as a preview; move away and they orbit again. Click a card and they dance it for good. Then choose a mood, a winter night by the harbour: System Two writes three for it, and the cards change. Undo brings back your pick.
/** @jsxImportSource ./stage */
import {
action,
choices,
useChoose,
useChoiceStatus,
generate,
type HostNode,
type Realization,
} from '@reintent/core';
import { MATERIALS, MOVEMENTS, TEMPOS, type Ballet, type Dancer, type Figure } from './catalog';
export { MATERIALS, MOVEMENTS, TEMPOS, type Ballet, type Dancer, type Figure };
export type Movement = Ballet['movement'];
export type Material = Ballet['material'];
export const MOVEMENT = { of: 'ballet', name: 'movement' };
export const MATERIAL = { of: 'ballet', name: 'material' };
export const TEMPO = { of: 'ballet', name: 'tempo' };
/** The score in a realization: the root's first node. */
export const balletOf = (r: Realization) => ((r.tree as HostNode).children[0] as HostNode).props as Ballet;
/** The moods a person can describe to System Two, one at a time (prompts.json, App.tsx). */
export const MOODS = ['A winter night by the harbour.', 'Fireflies over a rice field at dusk.'] as const;
export const FIGURE = { of: 'ballet', name: 'figure' };
/** What the stage dances while there is nothing to dance yet: a circle. */
const CIRCLE: Figure = { kind: 'circle', a: 1, b: 1, rx: 80, ry: 80 };
export const INVENT =
'Invent movements for twelve lanterns on a 480 by 300 stage, in the mood the person described, if any. Each lantern follows x = 240 + rx·sin(a·t + its phase), y = 150 + ry·sin(b·t). Each movement is JSON: {"kind": its name, two to four words, "a": a whole number 1 to 5, "b": a whole number 1 to 5, "rx": 40 to 220, "ry": 30 to 140}. Make them unlike each other.';
/** Why one of System Two's movements will not do (empty: it will): a path that does not close, or leaves the stage. */
export function figureErrors(f: Figure): string[] {
const errors: string[] = [];
if (typeof f?.kind !== 'string' || !f.kind) errors.push('no name');
for (const k of ['a', 'b'] as const)
if (!Number.isInteger(f?.[k]) || f[k] < 1 || f[k] > 5)
errors.push(`${k}: a whole number 1 to 5, or the path does not close`);
if (typeof f?.rx !== 'number' || f.rx < 40 || f.rx > 220)
errors.push('rx: 40 to 220, or it leaves the stage');
if (typeof f?.ry !== 'number' || f.ry < 30 || f.ry > 140)
errors.push('ry: 30 to 140, or it leaves the stage');
return errors;
}
/** Compile a choice of choreography into closed trajectories. Time belongs to the host. */
export default function App() {
const movement = useChoose(choices(...MOVEMENTS), { ...MOVEMENT, defaultValue: 'orbit' });
// Movements nobody listed: System Two writes three, the code keeps the ones that can be danced,
// and only the artist picks; the model never does.
const invented =
movement === 'invent'
? useChoiceStatus(generate<Figure>(INVENT, { n: 3, check: figureErrors }), {
...FIGURE,
defaultValue: CIRCLE,
ask: ['human'],
})
: undefined;
const figure = invented && invented.source !== 'default' ? invented.value : undefined;
const waiting = !invented || figure ? 'none' : invented.reason === 'none' ? 'model' : 'artist';
const preferred: Material =
movement === 'tide' ? 'ice' : movement === 'bloom' || movement === 'invent' ? 'firefly' : 'paper';
const material = useChoiceStatus(
choices<Material>(MATERIALS.map((value) => ({ value, weight: value === preferred ? 0.8 : 0.1 }))),
{ ...MATERIAL, defaultValue: preferred },
);
const tempo = useChoose(choices(...TEMPOS), { ...TEMPO, defaultValue: 'andante' });
const seconds = { largo: 18, andante: 12, presto: 6 }[tempo];
const dancers: Dancer[] = Array.from({ length: 12 }, (_, id) => {
const phase = (id * Math.PI) / 6;
const position = (t: number) => {
if (figure)
return [
240 + figure.rx * Math.sin(figure.a * t * Math.PI * 2 + phase),
150 + figure.ry * Math.sin(figure.b * t * Math.PI * 2),
];
const a = t * Math.PI * 2 + phase;
const r = movement === 'bloom' ? 65 + 35 * Math.cos(3 * a + phase) : 70 + id * 3;
return movement === 'tide'
? [240 + 175 * Math.sin(a), 150 + 65 * Math.sin(2 * a + phase)]
: [240 + r * Math.cos(a), 150 + r * Math.sin(a)];
};
const points = Array.from({ length: 49 }, (_, i) => position(i / 48));
return {
id,
x: points[0][0],
y: points[0][1],
delay: (-id * seconds) / 12,
path: points.map(([x, y], i) => `${i ? 'L' : 'M'}${x.toFixed(1)},${y.toFixed(1)}`).join(' ') + ' Z',
};
});
return (
<div>
{/* What the stage's controls do: the intent offers them, the host only sends them. */}
<ballet
movement={movement}
caption={
figure?.kind ??
{ none: movement, model: 'System Two is choreographing…', artist: 'Yours to pick' }[waiting]
}
waiting={waiting}
material={material.value}
source={material.source}
tempo={tempo}
seconds={seconds}
dancers={dancers}
move={action.decide(MOVEMENT)}
dress={action.decide(MATERIAL)}
undress={action.forget(MATERIAL)}
pace={action.decide(TEMPO)}
pick={action.decide(FIGURE)}
unpick={action.forget(FIGURE)}
/>
</div>
);
}
Starting…
Starting…
Nothing logged.
Three movements nobody listed
Orbit, tide and bloom are in the code. For invent, System Two writes three Lissajous figures { kind, a, b, rx, ry } in the mood the person described: kind is the movement's name, and the tag the artist picks it by. It writes a few numbers in a space the code chose, never paths; the code compiles a pick into twelve closed paths as it does the other movements.
check reads each candidate: a figure whose a or b is not a whole number would not close, and one too wide or tall would leave the stage. A candidate that will not do is dropped, so the artist is only offered what can be danced. The candidates have equal weights and the choice asks only the artist, so it stays unresolved, and intent.questions() names it, until the artist decides. The app holds the Intent, and the stage draws each offer with intent.preview({ 'ballet#figure': kind }): the score it would compile, with no decision and no undo entry.
The artist's pick is a decision, above the generated layer. Telling another mood does not change it, and System Two is not asked while it holds. Forgetting it asks for three in the current mood, so the stage's mood buttons tell the mood and forget the pick in one step (commit), which one undo takes back; Release movement only forgets it; a result is kept for the mood it was written under, so going back finds the same three without asking.
Why Reintent
The difference from the greeting card is who writes the possibilities. There, code lists them and System One weighs them; here System Two writes them and nobody weighs them, because there is nothing to be right about: the artist's taste is the answer. Reintent's layers keep the roles apart. The generated layer holds what the model wrote, check holds what the code allows, the decision layer holds what the artist chose, and preview lets the artist see every option before choosing one.
The realization is a motion score: twelve closed paths, phase offsets and a cycle, in a ballet node of the example's own catalog, which SVG animation in the React host performs. The intent reads neither time nor randomness. The stage's buttons send the actions the intent put on the node, the pick included (action.decide), and the catalog checks what they send.
This example follows design notes 0005 (choices and previews), 0006 (pure intent), 0012 (sandbox) and 0062 §5. The editable entry checks the check, the three candidates, that the question is the artist's, that each preview closes and changes nothing, the pick, and a new mood with the pick held and let go. System Two's movements are recorded, so the page calls no model.
Last updated on
Edit on GitHub