Seat view
NewA cinema seat picker that flies you down into the seat you chose and shows the screen from there before you book.
The live component, numbered part by part. Every measurement is read from it as it is drawn. Point at a row to outline its part, or at a part to find its row.
The choices it offers, each value drawn live and the default marked, with how to pick one.
When to use
- Booking a numbered seat where where you sit changes what you get: a cinema, a theatre, a concert hall, a stadium.
- A hall whose seats differ in more than price, such as distance, angle or a recliner row, so people can see the difference before they pay.
- A checkout people come back to, where a confident first choice saves a refund or a complaint.
When not to use
- Unnumbered seating or a standing crowd: a ticket count is enough.
- A hall where every seat sees the same, such as a small screening room. The map alone is quicker.
- A very large venue, with thousands of seats: pick a section first, then show the seats of that section.
- A screen reader’s only way to choose: the view is a picture. The map and the numbers beside the view carry everything it shows.
The flight
- 0 s: See the view. The map fades and the hall appears behind it in 3D, seen from straight above, laid out as the map was.
- 0 to 1.5 s: the camera drops towards the seat by equal ratios of height, so the fall reads as steady, and widens as it comes.
- 0.5 to 1.7 s: low over the rows, it tilts up to the screen and settles at the eye of someone sitting, 1.2 m above the seat.
- 1.7 s: the sheet rises. Drag the view to look around; it springs back when let go.
- Change seat: the same flight backwards, in 1.25 s, and the map fades back in.
The numbers
- Distance is from the seat to the middle of the screen, along the floor.
- Field of view is how wide the screen looks from the seat: the angle between its two edges.
- Off centre is how far the seat is to the left or right of the screen’s middle; within 0.2 m it reads Centred.
- The verdict is from the distance: under 7.4 m Up close, under 11.6 m Sweet spot, further Full picture.
Each one drawn with the component itself, used well or badly.
Short labels, in the words the ticket uses.
- Seats are named as on the ticket:
Row F, Seat 8, orF8where space is short. - Prices carry their currency and two decimals:
€12.50. - Distances are in metres with one decimal; angles are whole degrees.
You can add this component with the shadcn CLI or by hand:
Into components/seat-view of any React project, with no setup:
npx shadcn@latest add https://brunodelorence.com/r/seat-view.json- Copy the component files
Copy these files into one folder of your project, keeping their relative imports together, or download them as a ZIP:
- Copy the media files
To the same paths under your project’s public folder:
- Import it
As shown under Usage, below.
Either way it needs React 19.2 and a bundler that supports CSS Modules, such as Next.js or Vite.
Usage
import { SeatView, type Booking } from './seat-view';export function SeatPicker({ wide }: { wide: boolean }) { return ( <SeatView layout={wide ? 'desktop' : 'app'} autoplay={false} onBook={(booking: Booking) => fetch('/api/bookings', { method: 'POST', body: JSON.stringify({ room: booking.room, showing: booking.showtime.id, seat: booking.seat.id, capacity: booking.seat.capacity }), }) } /> );}Each state below is a live instance, locked so you can study it.
The pieces it is built from, each with its measurements read live.
A cinema booking screen with Classic seats, double reclining Lounge beds and Xtreme motion seats, as a phone app and desktop page. Compare screening darkness and house lights, locate surround and overhead speakers, and check the room temperature. On the phone you pick a seat on the map and press See the view: the map gives way to the hall in 3D, seen from straight above, and the camera drops into your seat and tilts up to the screen. A sheet rises with what the seat sees: how far the screen is, how wide it looks, how far off its middle, and Book. Drag the view to look around; Change seat flies back up to the map. On the desktop the map and the view sit side by side, and hovering a seat glides the camera to it, so seats can be compared before choosing one.
- Three room plans share the map and the 3D renderer: Classic has 126 leather seats, Beds has 20 double reclining Lounge loveseats for up to 40 guests, with shared footrests, service tables and shaded reading lamps, and Xtreme has 96 motion seats on hydraulic bases. Each has its own spacing, availability, seat kinds and prices. Changing rooms clears the previous selection and booking.
- Screening mode turns the house lights down: the movie and safety LEDs light the room. House lights reveals the upholstery, acoustic walls and furniture. The sound map marks the actual screen, surround and overhead source positions in the same 3D camera. Temperature is a configurable venue value in degrees Celsius, with room defaults of 21, 22 and 20.
- Xtreme uses an authored demonstration cue track sampled against the actual native video time. The seats pitch, roll and heave on their fixed bases; the eye view follows gently. Pausing the film, switching motion off, leaving the viewport or requesting reduced motion stops the moving seats.
- A shared WebGL renderer builds the auditorium in real 3D: rounded leather seats with headrests, inset back panels, stitching, armrests, cup holders and recliner footrests; carpeted stadium terraces, illuminated aisle treads, timber acoustic panels, speakers and a suspended ceiling. The upholstery uses a CC0 leather normal/roughness texture, a GGX dielectric BRDF and ACES tone mapping. A rectangular screen light and a warm ceiling light cast filtered depth shadows from the actual geometry; a rough Fresnel reflection intersects the screen plane. The same decoded video frame displayed on screen is downsampled into a 320 × 136 texture on requestVideoFrameCallback. That texture drives the area light and rough reflections, including while seeking; pause retains the exact frame. Leather uses higher roughness and restrained reflectance, without a clearcoat-like shine.
- The cinema screen plays the complete public Columbia Pictures trailer (about 2 minutes 53 seconds) in a loop for Spider-Man: No Way Home, from a local MP4 through one native HTML video element. A CSS homography projects it into the exact screen plane of the WebGL camera. The same video supplies the light/reflection pixels and Xtreme clock. Play, pause, mute, loop, hidden views and reduced motion control that single source; the publisher’s full caption track is linked and media provenance is bundled.
- The flight is a function of time between two cameras: the plan, high above the hall with a long lens so it reads as a map, and the eye of someone sitting in the seat. The height falls by equal ratios, so the drop reads as steady, the lens widens, and only once low does the camera tilt up to the screen.
- Camera flights and dragging draw as they move. Actual decoded video frames repaint the auditorium; camera animation can draw between them. Paused films and hidden instances retain their last frame. All instances share one WebGL context and immutable geometry. Reduced motion starts the film paused, with an explicit Play control.
- What a seat sees is worked out from where it is: the distance to the screen’s middle, the screen’s width as an angle between its two edges, and the offset from its middle. The verdict (Up close, Sweet spot, Full picture) comes from the distance.
- Each layout is laid out at its design size, the phone at 430 by 902 px and the window at 1180 by 720, and scaled as one picture to fit its box; the canvas sizes its pixels to its size on screen, so it stays sharp.
- The seat map is a grid for the keyboard: one seat is in the tab order, and the arrow keys, Home and End move between seats. On the desktop, hovering or focusing a seat shows its view, and a click chooses it.
- While on screen and untouched, a pointer picks a seat near the screen, one in the middle and a recliner at the back, and looks from each; on the desktop it hovers across the hall, then chooses a seat.
| Prop | Type | Default | Description |
|---|---|---|---|
defaultRoom | 'classic' | 'beds' | 'xtreme' | 'classic' | The starting room. Its map, furniture, availability and price change together. |
defaultHouseLights | boolean | false | Start with the house lights on, rather than screening darkness. |
defaultSoundMap | boolean | false | Show the projected sound source markers on the speakers. |
defaultMotion | boolean | true | Enable Xtreme’s demonstration motion track, while the film plays. Reduced motion always stops the moving seats. |
temperature | number | 21 / 22 / 20 by room | Venue-supplied degrees Celsius. The demo does not read a temperature sensor. |
layout | 'app' | 'desktop' | 'app' | The phone, which flies into the seat; or the browser window, with the view always beside the map. |
cinema | string | 'Meridian' | The cinema’s name, over the map. |
hall | string | 'Hall 3 · Fri 14 Nov' | The line under it: the hall and the day. |
showtimes | Showtime[] | SHOWTIMES | The showings, each with an id, a time and an optional format such as IMAX. The seats taken differ by showing. |
defaultShowtime | string | the second | The id of the showing chosen at first. |
defaultSeat | string | — | The seat chosen at first, such as "F8", unless it is taken. Given, it turns the demo off. |
defaultViewing | boolean | false | App only: opens on the view from defaultSeat, its sheet up. |
onSeatChange | (seat: Seat | null) => void | — | Called when a seat is chosen, or let go. |
onBook | (booking: Booking) => void | — | Called by Book, with the room, showing, seat and price. |
autoplay | boolean | true | While on screen and untouched, a pointer picks seats and looks from them; never under reduced motion. |
maxHeight | number | 640 (app), 900 (desktop) | The tallest the layout is drawn, in px. It is also never wider than its box: it scales down as one picture. |
className | string | — | Added to the root. |
Focus and keyboard
- The map is one stop in the tab order: the arrow keys move between seats, Home and End go to the ends of a row, Space or Enter chooses.
- On the desktop, moving the focus shows that seat’s view, as hovering does.
Screen readers
- Each seat is a toggle button named by its row, number, kind and price, or taken.
- The canvas is hidden: the sheet, or the desktop’s card, says in words and numbers what the view shows.
Motion
With reduced motion the camera cuts instead of flying, the sheet appears without rising, the demo stays still and the film starts paused. Play is an explicit choice.
In this build
- Each seat is a toggle button named by its row, number, kind and price, or taken: “Row F, seat 8, standard, €12.50, toggle button, pressed”. Taken seats are aria-disabled.
- The map takes one stop in the tab order; the arrow keys, Home and End move between seats, and Space or Enter chooses one.
- The 3D view is a picture and is hidden from screen readers: the sheet, or the desktop’s card, gives what it shows in words and numbers.
- Showings and room types are radio groups. Lighting, sound-source markers and Xtreme motion are labelled toggle buttons; the temperature has a spoken Celsius label. Seat and price changes are announced.
- Under reduced motion the camera cuts to the seat, the sheet appears without rising, the film starts paused and Xtreme seats remain still even if the reader explicitly plays the film.
The complete source behind this demo. Open source under the MIT license, © 2026 Bruno Delorence: copy it, change it, ship it.
// Copyright (c) 2026 Bruno Delorence. MIT License.'use client';import { useCallback, useEffect, useLayoutEffect, useMemo, useRef, useState, type KeyboardEvent, type PointerEvent as ReactPointerEvent, type ReactNode, type RefObject,} from 'react';import { DemoPointer, runDemo, type Demo } from './demo-pointer';import { ROOM_INFO, roomPlan, seatKindLabel, mapCamera, overviewCamera, seatCamera,/* Seat view (seat-view.tsx): a cinema's seat picker, dark as a cinema is, in two layouts. The app is a graphite phone; the desktop a browser window. Each is laid out at its design size (the phone 430 by 902 px, the window 1180 by 720) and scaled as one picture to fit its box, so every length below is a design px. Memory. Each layout has a hall canvas and a transparent sound-annotation canvas, drawn only when the view changes or its film plays. What moves is moved by transforms and opacity: the map and the hall cross-fade, the sheet rises, the pill fades. */.root { /* The interface: its text, the quieter text and lines, the surfaces, and the accent (the chosen seat, the live dot, the call to action). */ --ink: #f4f2ee; --muted: rgb(244 242 238 / 55%); --faint: rgb(244 242 238 / 32%); --line: rgb(255 255 255 / 8%); --fill: rgb(255 255 255 / 6%); --fill-strong: rgb(255 255 255 / 10%); --surface: #0b0b0d; --raised: #161619; --accent: #7fd39b; --accent-ink: #0c2615; --focus: #8ab4ff; /* The seats on the map. */ --seat: #3b3b41;// Copyright (c) 2026 Bruno Delorence. MIT License./* * The cinema hall: its seats, what each one costs and sees, and a small 3D renderer that draws the * hall on a 2D canvas from any camera. No library: each seat is two boxes (the cushion and the * back), each box is up to six quads, and each quad is projected through a pinhole camera, cut at * the near plane and filled, far ones first. The film on the screen is painted once, by hand, into * an offscreen canvas and drawn onto the screen's quad in thin vertical strips, each its own * affine transform, so it keeps its perspective. * * The world is in metres: x to the right as you face the screen, y up, z from the screen towards * the back of the hall. The screen is at z = 0; row A is 4.8 m from it and each row behind is * 1.15 m further and 0.34 m higher, as in a stadium hall. */export type SeatKind = 'standard' | 'recliner' | 'bed' | 'motion';export type RoomKind = 'classic' | 'beds' | 'xtreme';export type Seat = { /** "F8": the row's letter and the seat's number. */ id: string; row: string; number: number; kind: SeatKind;// Copyright (c) 2026 Bruno Delorence. MIT License.import { SCREEN, roomPlan, type RoomKind, type Seat, type Camera, type Look } from './hall';import { MATERIAL_FRAGMENT, SHADOW_FRAGMENT, loadCinemaTextures } from './cinema-materials';/* * A real depth-tested WebGL auditorium. One shared GPU surface serves the visible instances; * their 2D canvases keep the last rendered bitmap. Geometry and GPU buffers are built once. * Coordinates, eye height and row elevations are the same metres used by the booking map. */type V = [number, number, number];const vertices: number[] = [];let activeSeats: Seat[] = [];const geometry = new Map<RoomKind, Float32Array>();const clamp = (n: number, min: number, max: number) => Math.max(min, Math.min(max, n));const norm = (v: V): V => { const length = Math.hypot(...v) || 1; return v.map((n) => n / length) as V;};const W = 6.6;const BACK = 16.35;const red: V = [0.31, 0.035, 0.06];const leather: V = [0.035, 0.038, 0.049];const bronze: V = [0.19, 0.135, 0.085];// Copyright (c) 2026 Bruno Delorence. MIT License./** Packed CC0 Leather027 maps: OpenGL normal XY, roughness, albedo variation. */export function loadCinemaTextures(gl: WebGLRenderingContext, redraw: () => void) { const load = (url: string, pixel: number[], repeat: boolean) => { const texture = gl.createTexture()!; gl.bindTexture(gl.TEXTURE_2D, texture); gl.texImage2D( gl.TEXTURE_2D, 0, gl.RGBA, 1, 1, 0, gl.RGBA, gl.UNSIGNED_BYTE, new Uint8Array(pixel), ); gl.texParameteri(gl.TEXTURE_2D, gl.TEXTURE_MIN_FILTER, gl.LINEAR); gl.texParameteri(gl.TEXTURE_2D, gl.TEXTURE_MAG_FILTER, gl.LINEAR); gl.texParameteri(gl.TEXTURE_2D, gl.TEXTURE_WRAP_S, gl.CLAMP_TO_EDGE); gl.texParameteri(gl.TEXTURE_2D, gl.TEXTURE_WRAP_T, gl.CLAMP_TO_EDGE); const ready = new Promise<void>((resolve) => { const image = new Image();// Copyright (c) 2026 Bruno Delorence. MIT License.'use client';import { useEffect, useRef, useState } from 'react';import type { useHall } from './use-hall';import { CINEMA_FILM } from './cinema-film-source';import styles from './seat-view.module.css';/** One native video supplies both the projected picture and the actual decoded light frames. */export function CinemaFilm({ hall, active = true,}: { hall: ReturnType<typeof useHall>; active?: boolean;}) { const container = useRef<HTMLDivElement>(null); const video = useRef<HTMLVideoElement>(null); const [visible, setVisible] = useState(false); const [paused, setPaused] = useState(false); const [sound, setSound] = useState(false); const [loaded, setLoaded] = useState(false); const [reduced, setReduced] = useState(false); const [unavailable, setUnavailable] = useState(false);// Copyright (c) 2026 Bruno Delorence. MIT License./** The complete local Columbia Pictures trailer; screen and light share one native player. */export const CINEMA_FILM = { title: 'Spider-Man: No Way Home', src: '/experiments/seat-view/spider-man-trailer-full-3b0ca4312d7c.mp4', captions: 'https://vs-prodamdfandango.akamaized.net/NBCU_Fandango/244/971/source_1BD18461-FCEA-4FA7-835E-0C8A351848F2nowayhome_tr2_19748716195_en.vtt', poster: '/experiments/seat-view/spider-man-screen.webp', sourcePage: 'https://www.rottentomatoes.com/m/spider_man_no_way_home/videos/ww8kAAMF00Ss', /** The player, light texture and Xtreme cue track share the full trailer timeline. */ sourceStart: 0,} as const;// Copyright (c) 2026 Bruno Delorence. MIT License.'use client';import { createContext, useContext } from 'react';import { ROOM_INFO, roomPlan, type RoomKind } from './hall';import styles from './seat-view.module.css';export type RoomEnvironment = { room: RoomKind; setRoom: (room: RoomKind) => void; houseLights: boolean; setHouseLights: (on: boolean) => void; soundMap: boolean; setSoundMap: (on: boolean) => void; motion: boolean; setMotion: (on: boolean) => void; temperature: number;};export const RoomContext = createContext<RoomEnvironment | null>(null);export function useRoom() { const room = useContext(RoomContext); if (!room) throw new Error('Room controls belong inside SeatView.'); return room;}// Copyright (c) 2026 Bruno Delorence. MIT License.'use client';import { useCallback, useEffect, useMemo, useRef } from 'react';import { blendCamera, drawHall, flightCamera, type Camera, type Look } from './hall';import { drawCinema, drawSoundSources, projectScreen } from './cinema-gl';import { motionAt, useRoom } from './room-environment';/* * The canvas the hall is drawn on, and the moves of its camera. The hall is drawn only when * something changes: a move plays frame by frame and stops, a drag to look around draws as the * pointer moves and springs back, and a resize or a new look draws once. Between them the canvas * holds its last frame. New decoded video frames schedule the room's light and reflections; * hidden instances and paused films keep their last frame. * * Moves: `blend` eases every value of the camera together (the desktop's glide from seat to * seat); `land` is the app's flight from the plan down into a seat, and `lift` the same flight * played backwards. A move started during another starts from wherever the camera is. */export type Move = 'blend' | 'land' | 'lift';type Running = {// Copyright (c) 2026 Bruno Delorence. MIT License.'use client';import type { CSSProperties, Ref } from 'react';/* * The demo's pointer, and the steps that move it. A demo is a script of awaited steps: wait, or * glide the pointer somewhere. Stopping the demo (the reader takes over, or it scrolls away) ends * the step in progress at once: its promise rejects, which ends the script right there, and the * pointer fades out. * * Each glide is a curved flight played by the Web Animations API, so nothing runs frame by frame. * The points of the flight are handed to whoever wants to move along with it (nothing here uses * them yet). The arrow and the text cursor are HTML boxes * that swap by their visibility: a change of style inside an SVG would lay the SVG out again. */export type Point = { x: number; y: number };/** A glide's path and timing, for an animation that plays along with it. */export type Flight = { points: Point[]; timing: KeyframeAnimationOptions };export type Demo = {// Copyright (c) 2026 Bruno Delorence. MIT License.'use client';import { useCallback, useEffect, useRef, useState } from 'react';/* * When a demo may play on its own: while part of it is on screen and the tab is visible, never * under reduced motion, and never again once the reader has used it: `take()` hands it to the * reader for good (until the component mounts again), so it can't come back on its own. */export function useAutoplay<T extends HTMLElement>() { const ref = useRef<T>(null); const [visible, setVisible] = useState(false); const [reduced, setReduced] = useState(true); const [taken, setTaken] = useState(false); useEffect(() => { const element = ref.current; if (!element) return; let onScreen = false; const update = () => setVisible(onScreen && !document.hidden); const observer = new IntersectionObserver( ([entry]) => {