← All components Next componentChaos to Harmony→
Sections · Roadmap
Isometric Roadmap
An isometric board of stations: the camera travels diagonally from one to the next as each platform rises and lights up.
Installation
Use it in your project
Or skip the copy-paste
One command: writes the file and installs the dependencies.
$ npx deepui-cli add isometric-roadmap
01
Install
The 3D packages this component is built on.
$ npm install three @react-three/fiber @react-three/drei gsap && npm install -D @types/three
02
Add the component
One self-contained file: create components/IsometricGridRoadmap3D.tsx and paste it in.
components/IsometricGridRoadmap3D.tsx
1"use client";23import {4 memo,5 useEffect,6 useMemo,7 useRef,8 useState,9 type CSSProperties,10 type ReactNode,11 type RefObject,12} from "react";13import * as THREE from "three";14import { Canvas, useFrame, useThree, type CanvasProps } from "@react-three/fiber";15import { OrthographicCamera } from "@react-three/drei";16import gsap from "gsap";17import { ScrollTrigger } from "gsap/ScrollTrigger";1819/**20 * The shared props API of DeepUI's individual 3D components (not the full-page templates, which keep21 * their own tailored scenes).22 *23 * The props are grouped by concern. A component extends ONLY the groups it really applies, so its24 * type never advertises a knob that does nothing (a card has no particles, a background has no tilt):25 *26 * interface MyCardProps extends CursorProps, TiltProps, MaterialProps, PerformanceProps { … }27 *28 * `Base3DComponentProps` is every group at once, for tooling that handles any component. Same name,29 * same unit and same meaning everywhere; the default values live in DEFAULT_3D_PROPS. These files are30 * inlined into each component's single-file bundle (lib/bundle-source.mjs), only what it uses.31 */3233/** Which rotation axes follow the pointer. "x-only": the object nods (up / down); "y-only": it turns (left / right). */34export type TiltAxis = "both" | "x-only" | "y-only" | "none";3536/** 1. Cursor: how the pointer pulls, pushes and drags the object. */37interface CursorProps {38 /** Reach of the pointer's influence, in the component's own space: CSS pixels for pixel-laid-out widgets, world units for 3D scenes (each component says which). Default 220 (px). */39 cursorRadius?: number;40 /** Positive pulls things towards the pointer, negative pushes them away (repulsion, shockwave). Default 1. */41 cursorForce?: number;42 /** How far the object slides towards the pointer, 0 (stays put) to 1 (follows closely). Default 0. */43 magneticStrength?: number;44 /** Share of the remaining distance the motion closes each frame (at 60 fps), 0.01 (heavy, slow) to 1 (instant). Default 0.1. */45 cursorDamping?: number;46}4748/** 2. Tilt and parallax: the object leans towards the pointer, its layers slide against each other. */49interface TiltProps {50 /** Largest lean towards the pointer, in degrees. Default 15. */51 maxTiltAngle?: number;52 /** Axes that follow the pointer. Default "both". */53 tiltAxis?: TiltAxis;54 /** Lean away from the pointer instead of towards it. Default false. */55 invertTilt?: boolean;56 /** How far apart the depth layers slide when the object tilts, 0 (flat) to 2. Default 1. */57 parallaxOffset?: number;58}5960/** 3. Text and 3D typography, for components that draw a label. */61interface Text3DProps {62 /** The label drawn by the component. */63 text?: string;64 /** Scale of the lettering. Default 1. */65 fontSize?: number;66 /** Extrusion depth of 3D letters. Default 0.2. */67 textDepth?: number;68 /** Bevelled, light-catching edges on 3D letters. Default true. */69 bevelEnabled?: boolean;70 /** Custom font: a .woff / .ttf (flat text) or a typeface .json (extruded text). */71 fontUrl?: string;72}7374/** 4. Rendering, materials and glow. */75interface MaterialProps {76 /** Main color of the object. Default "#6366f1". */77 primaryColor?: string;78 /** Color of the glow. Default "#00f0ff". */79 emissiveColor?: string;80 /** Strength of the glow, 0 (none) to 3. Default 1. */81 emissiveIntensity?: number;82 /** 0 (mirror, glass) to 1 (matte). Default 0.3. */83 roughness?: number;84 /** 0 (plastic, organic) to 1 (metal). Default 0.5. */85 metalness?: number;86 /** 0 (opaque) to 1 (clear glass): see-through, refracting surfaces. Default 0. */87 transmission?: number;88 /** Technical wireframe rendering. Default false. */89 wireframe?: boolean;90}9192/** 5. Particles, idle motion and shader animation. */93interface MotionProps {94 /** Number of instanced elements. Default depends on the component. */95 particleCount?: number;96 /** Spin on its own, in radians per second (negative: the other way; 0.5 ≈ one turn in 12 s). Default 0. */97 autoRotateSpeed?: number;98 /** Pulses or ripples per second. Default 1. */99 pulseRate?: number;100 /** Amplitude of the noise deformation, 0 (none) to 2. Default 1. */101 displacementScale?: number;102}103104/** 6. Environment and camera. */105interface EnvironmentProps {106 /** Camera field of view, in degrees. Default depends on the component. */107 cameraFov?: number;108 /** Color of the depth fog. Default "#0a0a0a". */109 fogColor?: string;110 /** Thickness of the fog, 0 (none) to 0.2. Default 0. */111 fogDensity?: number;112}113114/** 7. Performance and accessibility. */115interface PerformanceProps {116 /** Lighter rendering for weak devices: pixel ratio 1, fewer instances, smaller environment maps. Default false. */117 lowPowerMode?: boolean;118 /** Under the OS "reduce motion" setting, stop idle spin, pulses and deformation (pointer feedback stays). Default true. */119 respectReducedMotion?: boolean;120 /** Stop the render loop while the component is scrolled out of view. Default true. */121 pauseWhenOffscreen?: boolean;122}123124/** Every group at once. Components extend only the groups they apply (see the top of this file). */125interface Base3DComponentProps126 extends CursorProps,127 TiltProps,128 Text3DProps,129 MaterialProps,130 MotionProps,131 EnvironmentProps,132 PerformanceProps {}133134type Defaults = Required<Omit<Base3DComponentProps, "text" | "fontUrl" | "particleCount" | "cameraFov">>;135136/** The values a prop takes when it is left out. A component may override one, and then documents it. */137const DEFAULT_3D_PROPS: Defaults = {138 cursorRadius: 220,139 cursorForce: 1,140 magneticStrength: 0,141 cursorDamping: 0.1,142 maxTiltAngle: 15,143 tiltAxis: "both",144 invertTilt: false,145 parallaxOffset: 1,146 fontSize: 1,147 textDepth: 0.2,148 bevelEnabled: true,149 primaryColor: "#6366f1",150 emissiveColor: "#00f0ff",151 emissiveIntensity: 1,152 roughness: 0.3,153 metalness: 0.5,154 transmission: 0,155 wireframe: false,156 autoRotateSpeed: 0,157 pulseRate: 1,158 displacementScale: 1,159 fogColor: "#0a0a0a",160 fogDensity: 0,161 lowPowerMode: false,162 respectReducedMotion: true,163 pauseWhenOffscreen: true,164};165166/** Fills the positioned parent. */167const FILL: CSSProperties = { position: "absolute", top: 0, left: 0, width: "100%", height: "100%" };168169interface PinnedScrollOptions {170 /** Scroll distance of the pin, in screen heights. Default 3. */171 length?: number;172 /** Disable the pin (the progress then runs while the section crosses the screen). */173 pin?: boolean;174}175176/**177 * Pins the section with GSAP ScrollTrigger (`pin: true`, scrubbed) for `length` screens of scroll and178 * returns a ref to the progress, 0 → 1. Read it in useFrame: scrolling never re-renders React. The179 * trigger is killed on unmount. Works with Lenis or any smooth scroll that updates ScrollTrigger.180 */181function usePinnedProgress(section: RefObject<HTMLElement | null>, { length = 3, pin = true }: PinnedScrollOptions = {}) {182 const progress = useRef(0);183 useEffect(() => {184 const el = section.current;185 if (!el) return undefined;186 gsap.registerPlugin(ScrollTrigger);187 const trigger = ScrollTrigger.create({188 trigger: el,189 start: pin ? "top top" : "top bottom",190 end: () => (pin ? `+=${window.innerHeight * length}` : "bottom top"),191 pin,192 scrub: 1,193 invalidateOnRefresh: true,194 onUpdate: (self) => {195 progress.current = self.progress;196 },197 });198 return () => trigger.kill();199 }, [section, length, pin]);200 return progress;201}202203interface SectionCanvasProps extends Omit<CanvasProps, "children" | "style" | "gl" | "frameloop">, Pick<PerformanceProps, "pauseWhenOffscreen" | "lowPowerMode"> {204 children: ReactNode;205 /** Pointer events for the 3D (raycasting). The canvas is click-through otherwise. */206 interactive?: boolean;207 /** Hidden from screen readers (default). Turn off when real HTML lives inside the canvas (drei <Html>). */208 decorative?: boolean;209}210211/** Touch screens (phones, tablets): far less GPU memory than a desktop, the tab is killed when it runs out. */212function isTouchDevice() {213 return typeof window !== "undefined" && window.matchMedia("(pointer: coarse)").matches;214}215216/**217 * Canvas filling its positioned parent: alpha, render loop paused while it is scrolled out of view.218 *219 * Memory, for pages that stack many of these (the templates have up to 9): the canvas only exists while220 * its section is within a screen of the viewport. Further away it is unmounted, and R3F disposes the221 * renderer and releases its WebGL context; it comes back, rebuilt, before it scrolls into view. On touch222 * screens the pixel ratio is capped at 1.5 and antialiasing is off: on an iPhone (ratio 3) a full-screen223 * canvas with MSAA takes hundreds of MB, and a few of them make Safari kill the tab ("a problem224 * repeatedly occurred").225 */226function SectionCanvas({ children, interactive = false, decorative = true, dpr, pauseWhenOffscreen = DEFAULT_3D_PROPS.pauseWhenOffscreen, lowPowerMode = DEFAULT_3D_PROPS.lowPowerMode, ...canvasProps }: SectionCanvasProps) {227 const ref = useRef<HTMLDivElement>(null);228 const [inView, setInView] = useState(true);229 const [near, setNear] = useState(false);230 const [touch] = useState(isTouchDevice);231 useEffect(() => {232 const el = ref.current;233 if (!el) return undefined;234 const visible = new IntersectionObserver(([entry]) => setInView(entry.isIntersecting));235 // One screen of margin above and below: built before it shows, released once well past236 const nearby = new IntersectionObserver(([entry]) => setNear(entry.isIntersecting), { rootMargin: "100% 0px" });237 visible.observe(el);238 nearby.observe(el);239 return () => {240 visible.disconnect();241 nearby.disconnect();242 };243 }, []);244 const maxDpr = lowPowerMode ? 1 : touch ? 1.5 : 2;245 const range: [number, number] = Array.isArray(dpr) ? [dpr[0], Math.min(dpr[1], maxDpr)] : [1, Math.min(typeof dpr === "number" ? dpr : 2, maxDpr)];246 return (247 <div ref={ref} aria-hidden={decorative ? "true" : undefined} style={{ ...FILL, pointerEvents: interactive ? "auto" : "none" }}>248 {near && (249 <Canvas250 dpr={range}251 frameloop={inView || !pauseWhenOffscreen ? "always" : "never"}252 gl={{ antialias: !touch, alpha: true, powerPreference: "high-performance" }}253 style={{ pointerEvents: interactive ? "auto" : "none", touchAction: "pan-y" }}254 {...canvasProps}255 >256 {children}257 </Canvas>258 )}259 </div>260 );261}262263/** True under 768px: scenes recompose (camera farther, layouts in columns). */264function useIsMobile() {265 const [mobile, setMobile] = useState(false);266 useEffect(() => {267 const query = window.matchMedia("(max-width: 767px)");268 const sync = () => setMobile(query.matches);269 sync();270 query.addEventListener("change", sync);271 return () => query.removeEventListener("change", sync);272 }, []);273 return mobile;274}275276const projected = new THREE.Vector3();277278/**279 * Moves HTML elements (cards, labels, counters) onto 3D points every frame, by transform only: the280 * text stays real HTML — crisp, selectable, read by screen readers, styled with your CSS. `points(i)`281 * returns the world position of anchor i (or null to hide it); `style(i, el, screen)` can add opacity,282 * scale… The elements must be absolutely positioned at the top-left of the canvas' container.283 */284function useAnchors(285 elements: RefObject<(HTMLElement | null)[]>,286 points: (i: number, target: THREE.Vector3) => THREE.Vector3 | null,287 style?: (i: number, el: HTMLElement, screen: { x: number; y: number; z: number }) => void288) {289 const camera = useThree((s) => s.camera);290 const size = useThree((s) => s.size);291 const target = useRef(new THREE.Vector3());292 useFrame(() => {293 const list = elements.current ?? [];294 list.forEach((el, i) => {295 if (!el) return;296 const p = points(i, target.current);297 if (!p) {298 el.style.visibility = "hidden";299 return;300 }301 projected.copy(p).project(camera);302 const behind = projected.z > 1;303 const x = (projected.x * 0.5 + 0.5) * size.width;304 const y = (-projected.y * 0.5 + 0.5) * size.height;305 el.style.visibility = behind ? "hidden" : "visible";306 el.style.transform = `translate3d(${x.toFixed(1)}px, ${y.toFixed(1)}px, 0) translate(-50%, -50%)`;307 style?.(i, el, { x, y, z: projected.z });308 });309 });310}311312/** Absolutely positioned at the top-left of the container: useAnchors moves it. */313const ANCHOR: CSSProperties = { position: "absolute", top: 0, left: 0, willChange: "transform", visibility: "hidden" };314315// Shared by the roadmap sections: the milestone shape and sample content.316317interface RoadmapMilestone {318 /** Short tag, e.g. "Q1 2026". */319 label: string;320 title: string;321 description?: string;322}323324const DEFAULT_MILESTONES: RoadmapMilestone[] = [325 { label: "Q1 2026", title: "Private beta", description: "The first 200 teams build with the core scenes." },326 { label: "Q2 2026", title: "Public launch", description: "Open sign-ups, the full component library and docs." },327 { label: "Q3 2026", title: "Team workspaces", description: "Shared presets, roles and a design token sync." },328 { label: "Q4 2026", title: "Visual editor", description: "Compose whole pages in 3D without writing code." },329 { label: "2027", title: "Marketplace", description: "Publish and sell your own scenes to the community." },330];331332export type { RoadmapMilestone };333334export interface IsometricGridRoadmapProps extends Pick<MaterialProps, "emissiveColor" | "primaryColor">, Pick<PerformanceProps, "pauseWhenOffscreen" | "lowPowerMode"> {335 milestones?: RoadmapMilestone[];336 heading?: string;337 /** Color of the reached stations and of the path. Default "#34d399". */338 emissiveColor?: string;339 /** @deprecated Use `emissiveColor`. */340 accentColor?: string;341 /** Color of the platforms not reached yet. Default "#1c1f2a". */342 primaryColor?: string;343 /** @deprecated Use `primaryColor`. */344 baseColor?: string;345 /** Scroll length of the pinned section, in screen heights. Default 4. */346 scrollLength?: number;347}348349const SPACING = 4.2;350351/** Stations climbing diagonally across the grid, alternating left and right of the diagonal. */352function stationPositions(n: number) {353 return Array.from({ length: n }, (_, i) => new THREE.Vector3(i * SPACING, 0, -i * SPACING * 0.55 + (i % 2 ? -1.8 : 1.8)));354}355356const floorVertex = /* glsl */ `357varying vec3 vWorld;358void main() {359 vec4 w = modelMatrix * vec4(position, 1.0);360 vWorld = w.xyz;361 gl_Position = projectionMatrix * viewMatrix * w;362}363`;364const floorFragment = /* glsl */ `365uniform vec3 uColor;366uniform vec3 uFocus;367varying vec3 vWorld;368void main() {369 vec2 g = abs(fract(vWorld.xz / 1.4) - 0.5);370 float line = 1.0 - smoothstep(0.0, 0.03, min(g.x, g.y));371 float d = distance(vWorld.xz, uFocus.xz);372 float glow = exp(-d * 0.22);373 vec3 color = mix(vec3(0.16, 0.17, 0.22), uColor, glow * 0.8);374 gl_FragColor = vec4(color, line * (0.25 + glow * 0.6));375 #include <colorspace_fragment>376}377`;378379interface SceneProps {380 milestones: RoadmapMilestone[];381 accentColor: string;382 baseColor: string;383 progress: RefObject<number>;384 labels: RefObject<(HTMLElement | null)[]>;385 mobile: boolean;386}387388const Board = memo(function Board({ milestones, accentColor, baseColor, progress, labels, mobile }: SceneProps) {389 const n = milestones.length;390 const camera = useThree((s) => s.camera) as THREE.OrthographicCamera;391 const size = useThree((s) => s.size);392 const stations = useMemo(() => stationPositions(n), [n]);393 const platform = useMemo(() => new THREE.BoxGeometry(2.2, 0.4, 2.2), []);394 const pylon = useMemo(() => new THREE.BoxGeometry(0.5, 1, 0.5), []);395 const floorGeo = useMemo(() => new THREE.PlaneGeometry(80, 80).rotateX(-Math.PI / 2), []);396 const floor = useMemo(397 () =>398 new THREE.ShaderMaterial({399 uniforms: { uColor: { value: new THREE.Color() }, uFocus: { value: new THREE.Vector3() } },400 vertexShader: floorVertex,401 fragmentShader: floorFragment,402 transparent: true,403 depthWrite: false,404 }),405 []406 );407 const mats = useMemo(() => milestones.map(() => new THREE.MeshStandardMaterial({ roughness: 0.45, metalness: 0.1 })), [milestones]);408 const path = useMemo(() => {409 const curve = new THREE.CatmullRomCurve3(stations.map((p) => p.clone().setY(0.02)), false, "centripetal");410 return new THREE.TubeGeometry(curve, 200, 0.06, 6, false);411 }, [stations]);412 const pathMat = useMemo(() => new THREE.MeshBasicMaterial({ toneMapped: false }), []);413 useEffect(() => {414 (floor.uniforms.uColor.value as THREE.Color).set(accentColor);415 pathMat.color.set(accentColor);416 }, [floor, pathMat, accentColor]);417 useEffect(() => () => path.dispose(), [path]);418 useEffect(() => () => mats.forEach((m) => m.dispose()), [mats]);419 useEffect(420 () => () => {421 [platform, pylon, floorGeo].forEach((g) => g.dispose());422 floor.dispose();423 pathMat.dispose();424 },425 [platform, pylon, floorGeo, floor, pathMat]426 );427428 const groups = useRef<(THREE.Group | null)[]>([]);429 const smooth = useRef(0);430 const focus = useMemo(() => new THREE.Vector3(), []);431 const base = useMemo(() => new THREE.Color(), []);432 const lit = useMemo(() => new THREE.Color(), []);433434 useFrame((_, delta) => {435 const dt = Math.min(delta, 1 / 30);436 smooth.current = THREE.MathUtils.damp(smooth.current, progress.current ?? 0, 5, dt);437 const s = smooth.current * (n - 1);438 // Diagonal travelling: the camera target glides from one station to the next439 const i0 = Math.floor(s);440 const i1 = Math.min(n - 1, i0 + 1);441 const f = THREE.MathUtils.smoothstep(s - i0, 0.15, 0.85);442 focus.lerpVectors(stations[i0], stations[i1], f);443 camera.position.set(focus.x + 20, 20, focus.z + 20);444 camera.lookAt(focus);445 camera.zoom = (Math.min(size.width, size.height * 1.3) / 15) * (mobile ? 1.15 : 1);446 camera.updateProjectionMatrix();447 (floor.uniforms.uFocus.value as THREE.Vector3).copy(focus);448449 base.set(baseColor);450 lit.set(accentColor);451 groups.current.forEach((g, i) => {452 if (!g) return;453 const reached = THREE.MathUtils.clamp(s - i + 1, 0, 1);454 const here = Math.max(0, 1 - Math.abs(s - i));455 g.position.y = THREE.MathUtils.damp(g.position.y, here * 0.9, 8, dt);456 mats[i].color.copy(base).lerp(lit, reached * 0.85);457 mats[i].emissive.copy(lit).multiplyScalar(here * 0.35);458 });459 });460461 useAnchors(462 labels,463 (i, target) => {464 const g = groups.current[i];465 return g ? target.set(stations[i].x, g.position.y + 2.2, stations[i].z) : null;466 },467 (i, el) => {468 const here = Math.max(0, 1 - Math.abs(smooth.current * (n - 1) - i));469 el.style.opacity = String(0.35 + here * 0.65);470 el.dataset.active = here > 0.6 ? "true" : "false";471 }472 );473474 return (475 <>476 <ambientLight intensity={0.6} />477 <directionalLight position={[8, 14, 6]} intensity={1.6} />478 <mesh geometry={floorGeo} material={floor} position={[stations[n - 1].x / 2, 0, stations[n - 1].z / 2]} />479 <mesh geometry={path} material={pathMat} />480 {stations.map((p, i) => (481 <group482 key={i}483 ref={(g) => {484 groups.current[i] = g;485 }}486 position={[p.x, 0, p.z]}487 >488 <mesh geometry={platform} material={mats[i]} position={[0, 0.2, 0]} />489 <mesh geometry={pylon} material={mats[i]} position={[0, 0.9, 0]} scale={[1, 0.8 + (i % 3) * 0.5, 1]} />490 </group>491 ))}492 </>493 );494});495496/**497 * Pinned roadmap on an isometric board: each milestone is a station on a glowing grid. As the498 * visitor scrolls, the camera travels diagonally from station to station; the station being reached499 * rises from the board and lights up, the ones passed keep the accent color.500 */501function IsometricGridRoadmap3D({502 milestones = DEFAULT_MILESTONES,503 heading = "One station at a time",504 emissiveColor,505 accentColor = emissiveColor ?? "#34d399",506 primaryColor,507 baseColor = primaryColor ?? "#1c1f2a",508 scrollLength = 4,509 pauseWhenOffscreen,510 lowPowerMode,511}: IsometricGridRoadmapProps) {512 const section = useRef<HTMLElement>(null);513 const labels = useRef<(HTMLElement | null)[]>([]);514 const progress = usePinnedProgress(section, { length: scrollLength });515 const mobile = useIsMobile();516517 return (518 <div>519 <section ref={section} className="relative h-svh w-full overflow-hidden bg-[#090a0f] text-white" aria-label={heading}>520 <SectionCanvas pauseWhenOffscreen={pauseWhenOffscreen} lowPowerMode={lowPowerMode}>521 <OrthographicCamera makeDefault position={[20, 20, 20]} near={0.1} far={200} />522 <Board milestones={milestones} accentColor={accentColor} baseColor={baseColor} progress={progress} labels={labels} mobile={mobile} />523 </SectionCanvas>524 <div className="pointer-events-none absolute inset-x-0 top-0 px-[6%] pt-20 sm:pt-24">525 <p className="font-mono text-xs uppercase tracking-[0.25em] text-white/50">Roadmap</p>526 <h2 className="mt-3 max-w-md text-4xl font-bold leading-[0.95] tracking-tighter sm:text-6xl">{heading}</h2>527 </div>528 <ol className="absolute inset-0 m-0 list-none p-0">529 {milestones.map((m, i) => (530 <li531 key={`${m.label}-${i}`}532 ref={(el) => {533 labels.current[i] = el;534 }}535 style={ANCHOR}536 className="group w-max max-w-[min(70vw,240px)] rounded-xl border border-white/10 bg-black/60 px-4 py-3 text-center backdrop-blur-md transition-[border-color] data-[active=true]:border-white/40"537 >538 <p className="font-mono text-xs uppercase tracking-[0.2em]" style={{ color: accentColor }}>539 {m.label}540 </p>541 <h3 className="mt-1 text-base font-bold tracking-tight">{m.title}</h3>542 {m.description && <p className="mt-1 hidden text-sm leading-snug text-white/65 group-data-[active=true]:block">{m.description}</p>}543 </li>544 ))}545 </ol>546 </section>547 </div>548 );549}550551export default memo(IsometricGridRoadmap3D);
03
Drop it in a page
It fills the box you put it in.
app/page.tsx
1import IsometricGridRoadmap3D from "@/components/IsometricGridRoadmap3D";23export default function Page() {4 return (5 <main>6 {/* …your other sections */}7 {/* A full-width section: it brings its own height (and its pinned scroll) */}8 <IsometricGridRoadmap3D />9 {/* …the rest of the page */}10 </main>11 );12}