Warp background
Also called warp tunnel, perspective grid tunnel, or hyperspace background
A tunnel of grid walls receding to a vanishing point, with streaks of light racing along them, that frames a card in the middle.
import type { ReactNode } from 'react';
import { motion, useReducedMotion } from 'motion/react';
const DEPTH = 640; // px each wall reaches into the screen (h-160 / w-160)
const BEAM = 110; // streak length in px
const LANES = [-140, -60, 20, 100]; // px from each wall's center line
const GRID =
'bg-[linear-gradient(to_right,var(--color-border)_1px,transparent_1px),linear-gradient(to_bottom,var(--color-border)_1px,transparent_1px)] bg-size-[40px_40px]';
// Each wall is a box edge turned 90° into the screen. `run` slides a streak
// from the far end to the near edge; `fade` keeps its bright head in front.
const WALLS = [
{
place: 'inset-x-0 top-0 h-160 origin-top -rotate-x-90',
run: { y: [DEPTH, -BEAM] },
fade: 'bg-linear-to-b'
},
{
place: 'inset-x-0 bottom-0 h-160 origin-bottom rotate-x-90',
run: { y: [-BEAM, DEPTH] },
fade: 'bg-linear-to-t'
},
{
place: 'inset-y-0 left-0 w-160 origin-left rotate-y-90',
run: { x: [DEPTH, -BEAM] },
fade: 'bg-linear-to-r'
},
{
place: 'inset-y-0 right-0 w-160 origin-right -rotate-y-90',
run: { x: [-BEAM, DEPTH] },
fade: 'bg-linear-to-l'
}
];
export function WarpBackground({ children }: { children: ReactNode }) {
const reduceMotion = useReducedMotion();
return (
<div className='relative grid h-96 place-items-center overflow-hidden'>
<div aria-hidden className='absolute inset-0 perspective-[220px]'>
{WALLS.map((wall) => (
<div
key={wall.place}
className={`absolute overflow-hidden ${GRID} ${wall.place}`}
>
{!reduceMotion &&
LANES.map((lane, i) => (
<motion.span
key={lane}
animate={wall.run}
transition={{
duration: 2.4 + i * 0.6,
delay: -i * 0.9,
repeat: Infinity,
ease: 'linear'
}}
className={`absolute top-0 left-0 rounded-full ${wall.fade} from-sky-400 to-transparent`}
style={
'x' in wall.run
? { top: `calc(50% + ${lane}px)`, width: BEAM, height: 3 }
: {
left: `calc(50% + ${lane}px)`,
width: 3,
height: BEAM
}
}
/>
))}
</div>
))}
</div>
{/* Fade the far end of the tunnel into the background. */}
<div
aria-hidden
className='absolute inset-0 bg-radial from-background from-30% to-transparent to-60%'
/>
<div className='relative'>{children}</div>
</div>
);
}Frame the "Your app is published" card with a warp background: a full-size container with perspective: 220px and four grid walls, each a container edge rotated 90° into the screen and 640px deep, drawn with faint 1px lines every 40px. Add 4 streaks per wall, each 3px wide and 110px long with a blue, purple, or pink head fading to transparent, sliding along a grid line from the far end to the near edge over 2 to 4.5s with linear timing and random negative delays. Fade the far end into the background with a radial gradient, hide the tunnel from screen readers, and stop the streaks when prefers-reduced-motion is set.
Paste into Layerwise or any AI coding tool.
What is Warp background?
A warp background surrounds a card with four grid planes that run back toward a single vanishing point, so the card seems to sit at the mouth of a tunnel. Colored streaks travel along the grid lines toward the viewer and give a sense of speed. It suits launch moments, deploy screens, and heroes that promise speed.
It is plain CSS 3D. A container sets perspective, and each wall is one of its edges turned 90° away from the viewer with rotateX or rotateY around that edge, painted with a repeating line gradient for the grid. Each streak is a small gradient element on a wall that loops its transform from the far end to the near edge. A smaller perspective value makes a deeper, more dramatic tunnel.
Hide the far end behind the card or a soft radial fade, and keep the streaks few and thin so the card stays the focus. Mark the tunnel aria-hidden. The streaks only change transform, so the loop is cheap, but stop them under prefers-reduced-motion and leave the still grid in place.
Often confused with
- Retro grid
- A retro grid is a single floor plane scrolling toward the horizon. A warp background surrounds the content with four walls that meet at one vanishing point.
Related terms
All termsPerspective
A CSS property that sets how far the viewer sits from a 3D scene, so rotated elements look deep up close and flatter from far away.
Grid background
A decorative background of thin grid lines, dots, stripes, or hexagons, often faded toward the edges, used behind hero sections and product shots.
Meteors
Thin streaks of light with bright heads that shoot diagonally across a dark card or hero at random intervals, like a meteor shower.
Border beam
A short streak of light that travels around the edge of a card or button on a loop, drawing attention to it.
Build it with Layerwise
Describe your app, watch it run in a live preview, and publish it with a database, storage, and sign-in built in.