center-split-reveal
pixel-perfect/center-split-revealFreeBlock
A center-split mask reveal — the image is clipped to a closed vertical seam down the middle, then the clip-path opens left and right to split it apart and uncover the whole frame.
Install it
npx shadcn@latest add https://www.pixel-perfect.space/r/center-split-reveal.jsonSource
1"use client";23/**4 * A center-split mask reveal — the image is clipped to a closed seam at the middle, then the clip-path opens outward (left/right for "horizontal", top/bottom for "vertical") to split it apart and uncover the whole frame.5 */67import { useEffect, useRef } from "react";8import gsap from "gsap";910const SRC = "/bend-image-reveal.gif";1112export type SplitAxis = "horizontal" | "vertical";1314const HIDDEN: Record<SplitAxis, string> = {15 horizontal: "inset(0% 50% 0% 50% round 12px)",16 vertical: "inset(50% 0% 50% 0% round 12px)",17};18const SHOWN = "inset(0% 0% 0% 0% round 12px)";1920const CenterSplitReveal = ({21 axis = "horizontal",22}: {23 axis?: SplitAxis;24}) => {25 const imgRef = useRef<HTMLImageElement>(null);2627 const reveal = () => {28 if (!imgRef.current) return;29 gsap.fromTo(30 imgRef.current,31 {32 clipPath: HIDDEN[axis],33 scale: 1.4,34 filter: "blur(16px)",35 },36 {37 clipPath: SHOWN,38 scale: 1,39 filter: "blur(0px)",40 duration: 1.2,41 ease: "power4.inOut",42 },43 );44 };4546 useEffect(() => {47 reveal();48 // eslint-disable-next-line react-hooks/exhaustive-deps49 }, [axis]);5051 return (52 <button53 onClick={reveal}54 className="relative aspect-video w-[40rem] max-w-[92%] cursor-pointer overflow-hidden rounded-xl"55 aria-label="Replay reveal"56 >57 <img58 ref={imgRef}59 src={SRC}60 alt="reveal"61 className="size-full object-cover"62 style={{63 clipPath: HIDDEN[axis],64 transform: "scale(1.4)",65 filter: "blur(16px)",66 }}67 />68 </button>69 );70};7172export default CenterSplitReveal;
What it pulls in
npm packages
Files it writes
More from pixel-perfect
All 332 items| Component | Registry | Kind | Access | Installs | Command |
|---|---|---|---|---|---|
| 3d-button3d-button | pixel-perfect | Blocks | Free | 2 deps | |
| abhinav-bento-buttonabhinav-bento-button | pixel-perfect | Blocks | Free | no deps | |
| accordion-carouselaccordion-carousel | pixel-perfect | Blocks | Free | 1 dep | |
| accordion-foldaccordion-fold | pixel-perfect | Blocks | Free | 1 dep | |
| activity-wheel-motionactivity-wheel-motion | pixel-perfect | Blocks | Free | 2 deps | |
| animated-textureanimated-texture | pixel-perfect | Blocks | Free | 1 dep | |
| aperture-mask-revealaperture-mask-reveal | pixel-perfect | Blocks | Free | 1 dep | |
| aurora-curtainaurora-curtain | pixel-perfect | Blocks | Free | no deps |
