# brainrot 010: dvd logo screensaver Live: https://brainrot.runfridge.dev/010/ Source: https://github.com/hwhang0917/brainrot/tree/main/010 License: MIT (see LICENSE at repo root); attribution only, no warranty. ## What it is The classic DVD screensaver: a DVD logo drifts diagonally on black and bounces off the window edges, changing colour on every bounce. The whole point is waiting for it to hit a corner dead on: when it does, a big "CORNER #n" pops up in the middle for 2.5 s. A HUD counts bounces and corners and forecasts "next corner in N s" (or "no corner in sight" if none within 30 minutes). One slider sets the speed (40-600 px/s, default 160). No sound, no pointer interaction, no URL params. ## How it was built - Rendering: pixi.js v8; the logo is a single `Sprite` of dvd.png (white on transparent, 800x361), tinted with `hsl(hue)`; the hue advances by the golden angle (137.5°) per bounce. - Model (`dvd.ts`): a box with position, size and velocity; `step` moves it in a straight line, clamps it back inside and reflects the velocity. Start heading is random but never along an axis (22.5°-67.5° within a random quadrant); start position random. - Corner detection is frame-rate independent: on a bounce it back-tracks along the line from the overshoot to the instant of contact and measures how far the box was from the other edge; within CORNER_TOLERANCE (1.5 px) it is a corner. Hitting both edges in one step is one bounce. - Forecast: `nextCorner` clones the box and steps it at 1/60 s (the same step as the live loop, so it sees the same near misses) up to 1800 s ahead. main.ts recomputes it only on a bounce, since the path only changes at the edges, and counts it down between bounces. - Resize keeps the heading, refits the logo (18% of screen width, min 110 px) and clamps it inside. Speed changes rescale the velocity vector. Frame dt capped at 0.05 s so a background tab cannot teleport the logo through a corner. - History: one feature commit ("DVD logo screensaver with a corner forecast"), then the site-wide hide-HUD button and the move from /10/ to /010/. Vibe coded: prompted into existence with a coding agent, iterated commit by commit. ## Files - 010/index.html: page shell, meta tags, inline CSS incl. the #corner pop animation (marked `data-keep` so it survives hide-HUD), speed slider. - 010/main.ts: pixi setup, logo sprite, sizing/resize, speed slider, ticker (step, recolour, corner banner, forecast HUD); imports `hsl` from lib/color.ts, `mountCrt` from lib/crt.ts, `mountHud` from lib/hud.ts. - 010/dvd.ts: pure model: `Box`, `create` (injectable rng), `step`, `nextCorner`, `CORNER_TOLERANCE`. - 010/dvd.test.ts: edge reflection, a corner counts once as one bounce, a 4 px near miss is not a corner even at speed, `nextCorner`'s eta matches what `step` then does. - 010/dvd.png: the logo image, imported as a Vite asset URL. ## Extending it - Run: `npm install && npm run dev`, open http://localhost:5173/010/ . Tests: `npm test`. Typecheck+build: `npm run build`. - Knobs: LOGO_FRACTION, LOGO_MIN_PX, MAX_DT, CORNER_SHOW_SECONDS, FORECAST_SECONDS, HUE_STEP at the top of main.ts; CORNER_TOLERANCE and FORECAST_DT in dvd.ts; speed range in index.html. - `box.hit` and `box.corner` are per-step flags (reset every `step`); `bounces`/`corners` are running totals. main.ts reacts to the flags. - Keep FORECAST_DT equal to the live step size and keep corner detection based on the back-tracked contact point, or the forecast and the real corners disagree (the last test guards this). - The forecast is O(FORECAST_SECONDS * 60) steps per bounce; fine at 1800 s, mind it if you raise it. - Conventions: keep pure simulation in its own module with a `node --test` file beside it; match the surrounding code style; Conventional Commits `type(010): message`.