A cinematic flight through a lit tunnel: scroll flies you through ribs of light, streaking particles and a glowing portal, with chromatic aberration and film grain.

  • shader
  • webgl
  • tunnel
  • scroll
  • background
  • interactive
Preset

Installation

Pro — coming soon

The source and installation instructions for this item ship with Kagadmodyaa Pro.

Usage

Use it like any other component. Choose a theme with preset; any prop you pass as well overrides the preset.

import { WarpTunnel } from '@/components/effects/warp-tunnel/warp-tunnel'

// 1. A pinned stage: the tunnel stays on screen while a tall wrapper scrolls past, and the scroll flies you through it.
export function Journey() {
  return (
    <section data-warp-track className="relative h-[500vh]">
      <div className="sticky top-0 h-screen">
        <WarpTunnel preset="Solar" className="absolute inset-0" />
        <h2 className="relative z-10 grid h-full place-items-center text-6xl text-white">Take the long way in.</h2>
      </div>
    </section>
  )
}

// 2. Drive it yourself: a number from 0 (the entrance) to 1 (the light). Jumps become a short warp.
export function Scrubbed({ value }: { value: number }) {
  return (
    <div className="relative h-96">
      <WarpTunnel preset="Abyss" progress={value} />
    </div>
  )
}

// 3. A calm hero: no scroll input, just a slow drift and a pointer that steers the vanishing point.
export function Hero() {
  return (
    <div className="relative h-[70vh]">
      <WarpTunnel preset="Synth" scrollDriven={false} speed={0.6} />
    </div>
  )
}

// Presets: Hyperspace, Solar, Abyss, Synth, Paper. Any prop you pass (colorA, twist, shape...) overrides the preset.
// scrollDriven reads, in order: scrollTarget, the nearest [data-warp-track] ancestor, the nearest scrollable ancestor, the page.
// The stage above is <WarpTunnelShowcase />, also exported: a scrollable stage with an Auto-fly switch.
<WarpTunnel preset="Solar" speed={1} />

Presets

  • Hyperspace
  • Solar
  • Abyss
  • Synth
  • Paper

Props

NameTypeDefaultDescription
preset'Hyperspace' | 'Solar' | 'Abyss' | 'Synth' | 'Paper'none (the defaults below)A named theme. Any prop you pass as well overrides the preset’s value.
speednumber1How fast the tunnel drifts by itself. 0 stops the drift; scrolling and progress still move you. Range 0 to 2.5.
twistnumber0.25Corkscrew of the wall panels along the tunnel. Negative twists the other way. Range -1 to 1.
shape'round' | 'squircle' | 'hex''round'Round, squircle or hexagonal tunnel.
ringDensitynumber1How many light ribs per unit of depth. Range 0.4 to 2.
segmentsnumber12Panels around the tunnel. Rounded to fit the cross-section (hex uses multiples of 6, squircle of 4). Range 4 to 32.
ribsnumber1Brightness of the light ribs and the larger gates. Range 0 to 1.5.
panelsnumber0.8Brightness of the panel seams and the data blocks that light up on the walls. Range 0 to 1.5.
streaksnumber1Amount of drifting particles. Range 0 to 1.5.
stretchnumber1How far particles and ribs stretch when you fly fast. Range 0 to 2.
glownumber1Strength of the glow at the vanishing point and around the light. Range 0 to 2.
aberrationnumber0.5Chromatic aberration at the edges. It grows with speed. Range 0 to 1.
grainnumber0.4Film grain. Range 0 to 1.
scrollDrivenbooleantrueRead the scroll position of a track, scroller or the page as flight progress.
progressnumber0Manual flight position, 0 to 1. Setting it takes over from scroll; leave at 0 for scroll to drive. Range 0 to 1.
steernumber0.6How far the pointer steers the vanishing point. Range 0 to 1.
colorAstring'#d4eeff'The light that lines the near walls (an ink colour on a light backdrop). A hex colour.
colorBstring'#4a82ff'The mid tunnel. A hex colour.
colorCstring'#7f5cff'The glow at the far end. A hex colour.
backgroundstring'#03050c'Backdrop. A light colour switches to ink on paper: the three colours become inks. A hex colour.
classNamestring—Extra class on the root element. The effect fills its parent: give the parent a height.
styleCSSProperties—Inline style on the root element.

Behaviour

  • Scroll flies you through. With scrollDriven on, the scroll position of a track (a tall element you pin the effect inside), a scroll container or the page becomes the flight progress, 0 at the entrance and 1 at the light. Progress is eased, and how fast it changes is what stretches the particles and ribs into streaks, widens the aberration and fans out the rays; when you stop they relax over about a second. Scrolling back flies in reverse.
  • With no input it drifts forward slowly, so it is never frozen. The pointer steers the vanishing point and the tunnel bends toward it, the far end more than the near walls. Set progress to take over from scroll (a slider, a timeline, your own state); set scrollDriven to false for a pure ambient background.
  • It sizes to its parent and sits behind your content: give the parent a height, then put your content above it with position and z-index. Pin it with position: sticky inside a tall data-warp-track wrapper for the classic scroll story.
  • It pauses while off screen and in a background tab, lowers its resolution automatically if frames run slow (the particle layers and the chromatic aberration are the first things dropped), and draws one composed still frame, with a little streak, under prefers-reduced-motion.
  • Without WebGL, and before the first frame, you see a CSS poster of the same tunnel in the same colours. The Paper preset (and any light background) switches to ink on cream: the three colours become pigments that darken the page instead of lighting it.

See all effects