Media · Component Template
WebGL Slider
A project slider that turns like a tri-vision billboard. A row of three-sided prisms rotates in a wave to show the next poster, and you can scrub it by hand.
Live demo
Drag across the board to scrub the turn, or use the arrows to change projects.
The Prompt
Build a project slider that changes slides the way a tri-vision billboard does. The whole screen is a row of tall three-sided prisms standing shoulder to shoulder, and the current poster is printed across their front faces. To change slide, every prism turns a third of a turn and presents its next face, but not all at once: the turn starts at the left edge and runs across the row as a wave, so for a moment the old poster and the new one are both on screen, sliced into strips, with the prisms between them edge-on and catching the light. Dragging scrubs that wave by hand. It is a real mechanism, computed per pixel, and it makes five flat posters feel like an object. The posters are not images: they are drawn in code for whatever proportions the screen has. The studio is fictional: Atlas & Finch, with five invented projects. Match my project's existing stack, conventions, and design tokens. If there are none, output a single HTML file with inline CSS and JavaScript and zero dependencies. LOOK Full-bleed, #0b0b0d behind. Over the board, in the difference blend mode so it reads on any poster: the studio name top left and the h1 top right, "Selected work, 2024 to 2026", both small. Bottom left a dark pill with the slide number in tabular figures, the project name as an h2 and one line about it; bottom right a pill with previous and next buttons and five dots. Both pills are #0b0b0d at 80% with a backdrop blur and a hairline. THE POSTERS Draw each with Canvas 2D at the stage's own aspect ratio (2048px wide at most) and redraw them all when the stage changes shape, so nothing is ever cropped. Shared layout: a flat ground; the project name in weight 800 with letter-spacing -0.05em, as large as min(21% of the width, 30% of the height), fitted to 90% of the width, sitting low but clear of the caption pill; a discipline top left and a year top right; one motif made of plain shapes in the upper right. 1. Kiln, identity for a ceramics studio, 2026: #eadccb, ink #3a2318, three arches in #c5532d, #f2b84b and brown, one disc. 2. Northline, a timetable app for a regional railway, 2025: #0f2a4a, white, three thick route lines (#ff6b3d, #5ad1ff, #ffd23f) that step down, with station dots. 3. Opaline, packaging for a skincare line, 2025: #f6c9d6, ink #b8254f, a large pearl with a radial gradient and two small discs. 4. Mosso, a website for a music school, 2024: #ffd23f, black, seven quarter rings of growing weight from the top right corner, one red disc. 5. Verde, a brand for a neighborhood grocer, 2024: #1f6b4a, cream, three discs with two leaves. THE BOARD One fragment shader, five textures. The state is a single number X: 2 means the third poster, 2.4 means two fifths of the way to the fourth. - Prisms: one per 54px of width, between 9 and 34. For a pixel, find its prism and also test the neighbor on each side, because a turning prism is wider than its slot. - Each prism's own progress: p = clamp(fract(X) × 1.6 − (index / (count − 1)) × 0.6, 0, 1), then a cubic ease in and out. Its position is floor(X) + p and its angle is 120° × that. The same formula run backwards makes the wave travel right to left when X decreases. - Cross-section: an equilateral triangle with circumradius 0.5774 slot widths, so a face seen square-on exactly fills the slot. Face f has its normal at angle f × 120° − the prism's angle. It is visible only where the cosine of that is positive, and it spans from R·sin(angle − 60°) to R·sin(angle + 60°) across. If the pixel is inside that span, t is how far across the face it is, and its depth is the same interpolation of R·cos; keep the nearest face. - Which poster is on face f: f + 3 × round((position − f) / 3), modulo five. That one line re-papers the two hidden faces without any bookkeeping. - Sample that poster at ((index + t) / count, y). Light it by 0.3 + 0.7 × cos^0.7, add a little directional light that follows the pointer and a soft highlight on faces turned away, and darken the last 3.5% at each edge of a face by 18% so the joins between prisms show even at rest. Behind the prisms, almost black. BEHAVIOR - X moves toward its target at a steady 1.05 slides per second; the easing belongs to the prisms, not to X. - Buttons, dots and the left and right arrow keys set the target. Dots take the shorter way round. The slider wraps. - Drag: X follows the pointer, one slide per 55% of the width. On release, a drag of more than 0.16 commits to the next slide in that direction; a smaller one returns. - The caption changes when X rounds to a new slide: fade out, swap, fade in, 220ms each way, announced politely. - Once, 3.2 seconds after load, if nothing has been touched, advance one slide to show how it turns. - Draw only while X, the fade or the light is changing. ACCESSIBILITY The stage is a region with the role description "carousel". The canvas is hidden from assistive technology; the caption is a live region with the number, the project name as a heading and its description. Previous and next are labeled buttons; each dot is a button named for its project with aria-current on the active one. With prefers-reduced-motion X jumps straight to its target, so slides change at once with no wave, and there is no automatic advance. If WebGL is unavailable, draw the current poster into a plain canvas; every control still works. NEVER - Never cross-fade. The point is that the board is a machine. - Never crop a poster to fit; redraw it for the screen. - Never animate every prism in step: without the wave it is a blink. - Never auto-play on a loop. - No images, no fonts, no libraries, no network requests.
- CopyThe full prompt, one click.
- PasteInto Cursor, Claude Code, or any agent.
- CompareAgainst the live demo above.