Floating Islands
A layered isometric pixel-art archipelago driven by requestAnimationFrame CSS custom properties (--terrain-x, --terrain-y). Foreground ledges, deep rock strata, drifting mist, and signal beacons respond smoothly to cursor position.
Move cursor across preview to drive parallax depth
Interactive Controls
variant
Installation
npm install framer-motionProps API
| Prop | Type | Default | Description |
|---|---|---|---|
| variant | "now" | "projects" | "now" | Switches rock silhouettes, platform hardware density, and skyline balance. |
| className | string | "" | Optional wrapper class for spacing or width constraints. |
- Pointer tracking updates only CSS custom properties inside requestAnimationFrame with zero React state re-renders.
- Attaches listener to the enclosing <section> so nearby cursor motion drives parallax depth.
- Freezes parallax and mist animations automatically when prefers-reduced-motion is enabled.
Source Files
"use client";
import React, { useRef, useEffect } from "react";
import { motion, useReducedMotion, type Variants } from "framer-motion";
import {
terrainContainerVariants,
terrainShelfVariants,
terrainForeVariants,
terrainMidVariants,
terrainDeepVariants,
terrainDebrisVariants,
terrainMistVariants,
} from "@/lib/motion";
import styles from "./FloatingTerrain.module.css";
export interface FloatingTerrainProps {
variant?: "now" | "projects";
className?: string;
variants?: Variants;
}
/** Surface-only details stay inside the existing shelf and inherit its motion. */
function ShelfHardware() {
return (