InputLightweight
Live API
Fresh data fetched from a service.
Fetching fresh data from somewhere else when the page loads or every few minutes: weather, prices, a content system. The scene shows something that is true right now. Keys must stay on a server, never in the page.
- Breaks when
- CORSrate limitskeys leak in client code
- Also called
- REST, polling, fetch
Prompts
Weather-driven scene
Poll an open weather endpoint every 10 minutes (with a serverless proxy that holds the key and sets CORS) and map the response to a Three.js scene: cloud cover to fog density, wind speed to particle drift, temperature to a two-color ramp. Show the last update time; on a fetch error keep the last good state and retry with exponential backoff (10 s → 5 min). Pause polling when the tab is hidden.
One value, made physical
Fetch a single number from an API every 30 s (visitors online) and drive a physical gauge: a Three.js needle with a spring toward the value, a ring of instanced markers that light up to the count, and a soft tick sound on change. Handle a 429 by doubling the interval and showing “rate limited” quietly.
Optimistic content from a CMS
Render a gallery from a headless CMS JSON at build time, then re-fetch on load and diff: new items animate in with FLIP, removed ones fade out, unchanged ones stay put. Cache the last response in localStorage so the first paint never waits on the network.
Related
Resources
None yet. Find one and add it with npm run add -- <url>.