Detent web components
By Shane Logsdon

Media & effects

Speed Warp

Implemented

High-velocity 3D perspective starfield tunnel with canvas streaks.

detent-speed-warp

Port status
Catalog status
implemented
Origin
upstream
Phase
4
Wave
phase-4-canvas
Group
Media & effects
speed 25, 600 stars

3.3 KB gzip for the class module

Variants

The starfield is one transparent canvas in front of the slotted content. It pauses while offscreen, while the tab is hidden and when paused is present, and it paints a single static frame with prefers-reduced-motion: reduce. The slotted headlines are the readable layer and stay in the light DOM.

speed 90, 1200 stars speed −20 (receding)

Every setting is a scalar attribute with a matching property. className is gone: the documented parts (canvas, content) and the --detent-speed-warp-height/--detent-speed-warp-radius/--detent-speed-warp-surface custom properties are the supported knobs.

Recorded states

  • paused recorded state; no setter
  • reduced motion recorded state; no setter

Usage

Import

import '/components/speed-warp/define.js';

// or register it yourself
import { DetentSpeedWarp } from '/components/speed-warp/speed-warp.js';

Attributes

  • paused
  • speed
  • star-count

Properties

No properties are recorded for this component.

Slots

  • default

Events

No events are recorded for this component.

Example

Runnable example: site/examples/speed-warp.ts. The snippet below is generated from the catalogued attributes.

<detent-speed-warp
  paused
  speed="25"
  star-count="600"
></detent-speed-warp>

Source

The pinned upstream source for this row:

  • src/components/ui/SpeedWarp.tsx sha256 40c31ad2b401…

Native files

The native module and its artifacts:

  • src/components/speed-warp/speed-warp.ts
  • src/components/speed-warp/styles.css
  • src/components/speed-warp/define.ts
  • docs/components/speed-warp.md
  • site/examples/speed-warp.ts
  • tests/browser/speed-warp.spec.ts
  • evidence/components/speed-warp.md

API

Boolean attributes follow HTML presence semantics: present means true, absent means false, and disabled="false" still means disabled.

Attributes

Attributes
AttributePropertyTypeDefaultNotes
paused———Recorded in the catalog as an attribute.
speedspeednumber25Kebab-case attribute; camelCase property.
star-countstarCountnumber600Kebab-case attribute; camelCase property.

Properties

No property-only values are recorded for this component.

Events

No custom events are recorded for this component.

Slots

Slots
SlotNotes
defaultConsumer content; rendered through a slot, never re-created.

CSS customisation

  • React `children`/`ReactNode` props become DOM slots; caller content stays light DOM.
  • `className` prop is replaced by documented CSS parts/custom properties; no Tailwind in consumers.
  • React state/hooks replaced by element-owned state with pre-upgrade property preservation.
  • Reduced motion stops the loop and paints one static frame; the pinned source animates (PC-10.5 addition, proved by the absence of a prefers-reduced-motion branch).
  • A hidden document stops the loop through visibilitychange; the source has no visibilitychange handler.
  • The star field is kept across speed changes and reconnection instead of being re-created on every effect run.
  • The canvas backing store honours devicePixelRatio capped at 2 while drawing in CSS px.
  • star-count clamps to 0..2000, rounded, with one development warning.
  • The host is position: relative with a documented min height (320px default, --detent-speed-warp-height) instead of absolute inset-0.

What it does

A transparent 3D perspective starfield tunnel — a warp/hyperspace background you layer behind a hero, a card or a full-screen splash.

Upstream behaviour
  • Real-time 3D perspective projection with focal length scaling
  • Dynamic depth-alpha fading and velocity-driven streak lines
  • Completely transparent canvas background for seamless layering over any dark UI or hero section
  • Automatic canvas resizing via ResizeObserver to match parent container dimensions
Differences from upstream
  • React `children`/`ReactNode` props become DOM slots; caller content stays light DOM.
  • `className` prop is replaced by documented CSS parts/custom properties; no Tailwind in consumers.
  • React state/hooks replaced by element-owned state with pre-upgrade property preservation.
  • Reduced motion stops the loop and paints one static frame; the pinned source animates (PC-10.5 addition, proved by the absence of a prefers-reduced-motion branch).
  • A hidden document stops the loop through visibilitychange; the source has no visibilitychange handler.
  • The star field is kept across speed changes and reconnection instead of being re-created on every effect run.
  • The canvas backing store honours devicePixelRatio capped at 2 while drawing in CSS px.
  • star-count clamps to 0..2000, rounded, with one development warning.
  • The host is position: relative with a documented min height (320px default, --detent-speed-warp-height) instead of absolute inset-0.
Previous: Sparkles Next: Split Button

Docs

Components

Project