Installation
npx kinetic-ui-cli@latest add infinite-fractal-zoomMechanics
This component implements a Stargate or "Doctor Who" style infinite zoom sequence using Framer Motion's useScroll and useTransform:
- Sticky Context: The wrapper div is set to
300vhtall, while the inner viewport is100vhandsticky top-0. This traps the user in a scrolling context for a long duration. - Exponential Scale: We generate multiple
<ZoomLayer />concentric squares. We map the globalscrollYProgress(0 to 1) to an exponential curve (Math.pow) modifying thescaleCSS property of each layer. - Opacity Clipping: As a layer's scale becomes massively huge (passing the camera) or incredibly small (fading into the void), its opacity drops to
0. This gives the illusion of infinite procedural generation.
Usage Guide
1. Import the Component
Import the component into your React or Next.js page:
import { InfiniteFractalZoom } from "@/components/creative/infinite-fractal-zoom";
2. Implementation Example
Render the component and customize its behavior by passing props:
import { InfiniteFractalZoom } from "@/components/creative/infinite-fractal-zoom";
export default function Example() {
return (
<div className="w-full flex items-center justify-center p-8">
<InfiniteFractalZoom
/>
</div>
);
}