InputMiddleweight
LLM in the loop
A language model changes the scene as it runs.
A language model changes the scene while it runs: type “calmer, more fog” and the fog rises. The model returns a few numbers, and the scene eases toward them. Each request takes a second or two and needs a small server to hold the key.
- Breaks when
- latency of secondsAPI key exposure on a static site
- Also called
- AI-driven, generative UI, agentic
Prompts
Mood to parameters
A text input sends the sentence to a serverless endpoint that calls the Claude API (claude-sonnet-5) with a system prompt asking for JSON matching { fog: 0..1, speed: 0..1, count: 0..1, palette: "warm" | "cool" | "mono" } and nothing else. Validate the JSON, clamp the numbers, and tween the Three.js scene’s uniforms to them over 1.2 s with a cubic ease. Show the raw JSON in a corner while it streams. Cache identical sentences; rate-limit to one request per 2 s.Model as a caption writer
For each generated artwork (seeded), send the seed’s parameters (not the image) to the model and ask for a two-line title and description in a fixed voice; stream the text into the caption with a typewriter effect. Keep the request body under 300 tokens and explain why the parameters beat the pixels as context.
Code generation with a safety net
Let the model write a small GLSL function (float pattern(vec2 uv, float t)) from a description, compile it into a fixed shader template, and if compilation fails show the error and keep the previous working shader. Sandbox the generated code to that one function; never eval JS from the model.
Related
Resources
None yet. Find one and add it with npm run add -- <url>.