Depth Parallax Scene
motiq/depth-parallax-sceneFreeComponent
A world behind the glass: consumer-supplied layers travel at depth-proportional rates as the scene passes through the viewport and drift subtly with the pointer, while the far layers slip out of focus as the near ones pass. translate3d only, quantized depth-of-field blur, one rAF loop, no scroll container in page mode, reduced-motion frozen composition.
Live preview
live · rendered by the registry
Rendered by motiq on their own page — this is the component running, not a screenshot of it.Install it
npx shadcn@latest add https://www.motiq.dev/r/depth-parallax-scene.jsonSource
1"use client";23import * as React from "react";45import { cn } from "@/lib/utils";6import { useReducedMotion, useVisibilityPause } from "@/lib/motiq";78/* -------------------------------------------------------------------------- */9/* Types */10/* -------------------------------------------------------------------------- */1112export interface ParallaxLayer {13 /** Anything renderable — an SVG ridge, a gradient sky, floating cards. */14 node: React.ReactNode;15 /** 0 = far background (barely travels) … 1 = nearest foreground (travels most). */16 depth: number;17 /**18 * Max depth-of-field blur in px applied to this layer as the scene centers.19 * Set it on the far layers only; near layers should stay sharp.20 */21 blurAtDepth?: number;22}2324export interface DepthParallaxSceneProps extends Omit<React.HTMLAttributes<HTMLDivElement>, "children"> {25 /** Back-to-front layers. Order is paint order; `depth` drives travel and drift. */26 layers: ParallaxLayer[];27 /**28 * `"page"` (default) reads the scene's position in the viewport — the landing-page29 * usage, with no scroll container of its own. `"container"` gives the component a30 * keyboard-scrollable stage so the effect works inside a card or docs preview.31 */32 scrollMode?: "page" | "container";33 /** Total vertical travel in px at depth 1 across the whole pass. */34 range?: number;35 /** Let the pointer nudge the layers. */36 pointer?: boolean;37 /** Horizontal pointer travel in px at depth 1 (vertical is ~54% of it). */38 pointerStrength?: number;39 /** Apply `blurAtDepth` to the layers that declare it. */40 depthOfField?: boolean;41 /** Idle sine drift before the pointer ever enters — the ambient life on load. */42 ambientDrift?: boolean;43 /** Scene height. */44 height?: number | string;45 /** Container mode only: pass distance as a multiple of the scene height. */46 scrollLength?: number;47 /** Progress smoothing rate (λ per second). */48 smoothing?: number;49 /** Accessible description — the scene is decorative and carries a single role="img". */50 label?: string;51 /** Force the static, motion-free variant regardless of system preference. */52 reducedMotion?: boolean;53}5455/* -------------------------------------------------------------------------- */56/* Constants + helpers */57/* -------------------------------------------------------------------------- */5859// … truncated
What it pulls in
Other registry items
Files it writes
More from motiq
All 100 items| Component | Registry | Kind | Access | Installs | Command |
|---|---|---|---|---|---|
| Activity Streamactivity-stream | motiq | Components | Free | 1 dep | |
| Adaptive Safe-Zone Gridadaptive-safe-zone-grid | motiq | Components | Free | no deps | |
| Agent Run Timelineagent-run-timeline | motiq | Components | Free | 1 dep | |
| AI Response Streamai-response-stream | motiq | Components | Free | 1 dep | |
| Animated Accordionanimated-accordion | motiq | Components | Free | 2 deps | |
| Animated Buttonanimated-button | motiq | Components | Free | 1 dep | |
| Animated Dialoganimated-dialog | motiq | Components | Free | 2 deps | |
| Animated Gridanimated-grid | motiq | Components | Free | 2 deps |
