No.211 · Backgrounds
Bokeh City
A city at night through a fast lens wide open: every light a soft disc with the slightly brighter rim real bokeh has, in three depths that drift past each other with the pointer, twinkling — and along the bottom, traffic passing as long defocused streaks.
The prompt
Written for the variant you picked above: Muscat night
Build a canvas 2D background of out-of-focus city lights. Discs: pre-render one sprite per palette colour: a radial gradient with an even fill (alpha .5 → .56), a brighter rim (.74–.82 at 82–90% radius) and a soft falloff to zero by the edge — the look of real bokeh, without a hard edge. Scatter ~1 per 8,000px² (50–170) over the lower 60% of the frame (biased toward the middle, like a skyline) in three depths: far (7–16px radius, alpha ~.78, each over a wide edgeless glow three times its size), mid (18–38px, ~.46), near (40–86px, ~.24). Colours are drawn by weight from the theme's palette. Each disc twinkles (alpha × 0.75–1 on its own slow sine) and drifts sideways slowly, faster when nearer. All discs are drawn with additive ("lighter") compositing. Parallax: the pointer offsets each depth by a different amount (1.2%, 3.5%, 8% of the frame), eased at 2.5/s, so the layers slide past each other. Traffic: along the bottom, long soft capsule sprites (horizontal and vertical gradient masks) — red tail lights travelling right in the lower lane and white headlights travelling left in the upper, respawning off-screen. A radial vignette finishes the lens. One rAF loop while visible; ~33fps on touch; reduced motion draws one frame. Selected variant — Muscat night (muscat): theme="muscat": a warm city palette — mostly amber, warm white, cream and orange, with a little teal and blue; clear weather. This selection takes precedence over references to other themes or options in the general brief. Implement this selected appearance; do not add a variant picker or alternative appearances unless requested. Implementation requirements: Use React and TypeScript. Keep the component self-contained, with uniquely scoped CSS and no animation libraries. Include required imports, styles and font setup in the result. Interaction: Move the pointer to slide the depths past each other. Motion: Discs twinkle and drift; traffic streaks at 90–210px/s; parallax eases at 2.5/s. Accessibility: The canvas is aria-hidden and decorative; overlay text sits above it. Reduced motion draws one still frame. Responsive behavior: Disc count and traffic scale with the canvas; everything is rebuilt on resize. Touch: No parallax on touch; the city still twinkles and traffic passes, at ~33fps. Preserve keyboard access, visible focus and reduced-motion behavior. Keep fictional demo data and simulated service calls in a separate usage example; expose callbacks for real actions and recover from rejected requests. Keep usage-example links inside the demo: use local buttons or prevent navigation. Demonstration links must not navigate to Vitrine routes or open other pages; preserve real URL support in the reusable component itself. Verify the result at narrow and wide viewport sizes, with keyboard input and reduced motion enabled.
Notes
- Interaction
- Move the pointer to slide the depths past each other.
- Motion
- Discs twinkle and drift; traffic streaks at 90–210px/s; parallax eases at 2.5/s.
- Accessibility
- The canvas is aria-hidden and decorative; overlay text sits above it. Reduced motion draws one still frame.
- Responsive
- Disc count and traffic scale with the canvas; everything is rebuilt on resize.
- On touch
- No parallax on touch; the city still twinkles and traffic passes, at ~33fps.