scroll-choreography
componentry/scroll-choreographyFreeComponent
Component for scroll-choreography
Live preview
live · rendered by the registry
Rendered by componentry on their own page — this is the component running, not a screenshot of it.Install it
npx shadcn@latest add https://componentry.dev/r/scroll-choreography.jsonSource
1"use client";23import { motion, useScroll, useSpring, useTransform } from "framer-motion";4import { useRef } from "react";5import { cn } from "@workspace/ui/lib/utils";67interface ScrollChoreographyProps {8 className?: string;9 images: {10 topLeft: string;11 topRight: string;12 bottomLeft: string;13 bottomRight: string;14 };15}1617export function ScrollChoreography({18 className,19 images,20}: ScrollChoreographyProps) {21 const containerRef = useRef<HTMLDivElement>(null);2223 const { scrollYProgress } = useScroll({24 target: containerRef,25 offset: ["start start", "end end"],26 });2728 const smoothProgress = useSpring(scrollYProgress, {29 stiffness: 400, // Higher stiffness for a slightly faster snap30 damping: 50, // Play with damping to add a little bounce/jerk31 mass: 1.2, // Adds a bit more weight to the movement32 restDelta: 0.001,33 });3435 // Default positions relative to center36 const xLeft = "-20vw";37 const xRight = "20vw";38 const yTop = "-14vh";39 const yBottom = "14vh";4041 // Phase 1: 0 - 0.3 (Diagonal movement)42 // Phase 2: 0.35 - 0.65 (Stack alignment to center)43 // Phase 3: 0.7 - 0.9 (Top Right expands to full screen)4445 // Top Left -> moves to Bottom Left, then to Center46 const tlX = useTransform(smoothProgress, [0, 0.3, 0.35, 0.65, 1], [xLeft, xLeft, xLeft, "0vw", "0vw"]);47 const tlY = useTransform(smoothProgress, [0, 0.3, 0.35, 0.65, 1], [yTop, yBottom, yBottom, "0vh", "0vh"]);4849 // Bottom Right -> moves to Top Right, then to Center50 const brX = useTransform(smoothProgress, [0, 0.3, 0.35, 0.65, 1], [xRight, xRight, xRight, "0vw", "0vw"]);51 const brY = useTransform(smoothProgress, [0, 0.3, 0.35, 0.65, 1], [yBottom, yTop, yTop, "0vh", "0vh"]);5253 // Bottom Left -> stays, then moves to Center54 const blX = useTransform(smoothProgress, [0, 0.3, 0.35, 0.65, 1], [xLeft, xLeft, xLeft, "0vw", "0vw"]);55 const blY = useTransform(smoothProgress, [0, 0.3, 0.35, 0.65, 1], [yBottom, yBottom, yBottom, "0vh", "0vh"]);5657 // Top Right -> stays, then moves to Center, then expands58 const trX = useTransform(smoothProgress, [0, 0.3, 0.35, 0.65, 1], [xRight, xRight, xRight, "0vw", "0vw"]);59 const trY = useTransform(smoothProgress, [0, 0.3, 0.35, 0.65, 1], [yTop, yTop, yTop, "0vh", "0vh"]);6061 // Top Right (Hero) scaling/expansion properties62 const heroWidth = useTransform(smoothProgress, [0.65, 0.7, 0.9, 1], ["36vw", "36vw", "100vw", "100vw"]);63// … truncated
More from componentry
All 59 items| Component | Registry | Kind | Access | Installs | Command |
|---|---|---|---|---|---|
| Animated Gradientanimated-gradient | componentry | Components | Free | no deps | |
| ASCII Effectascii-effect | componentry | Components | Free | no deps | |
| Aurora Flowaurora-flow | componentry | Components | Free | no deps | |
| auth-modalauth-modal | componentry | Components | Free | no deps | |
| border-beamborder-beam | componentry | Components | Free | no deps | |
| circuit-boardcircuit-board | componentry | Components | Free | no deps | |
| closing-plasmaclosing-plasma | componentry | Components | Free | no deps | |
| collection-surfercollection-surfer | componentry | Components | Free | no deps |
