"use client"; import React, { useEffect, useRef } from "react"; import gsap from "gsap"; import Image from "next/image"; const Loader = () => { // We need a DOM node that will be the clipping container const containerRef = useRef(null); const imgRef = useRef(null); useEffect(() => { const container = containerRef.current; const img = imgRef.current; if (!container || !img) return; gsap.set(container, { width: "0", clipPath: "inset(0 100% 0 0)" }); gsap.to(container, { width: "280px", // reveal left to right duration: 1.4, clipPath: "inset(0 0% 0 0)", ease: "expo.inout", }); }, []); return (
{/* Clipping container */}
Whispering Trees
); }; export default Loader;