"use client"; import { useEffect, useRef } from "react"; import gsap from "gsap"; export function Hero() { const rootRef = useRef(null); useEffect(() => { const ctx = gsap.context(() => { // 细线缓慢绘制 gsap.fromTo( ".hero-line", { strokeDashoffset: 600 }, { strokeDashoffset: 0, duration: 2.4, ease: "power2.inOut", stagger: 0.3 } ); gsap.fromTo( ".hero-shape", { opacity: 0, scale: 0.96 }, { opacity: 1, scale: 1, duration: 1.8, ease: "power2.out", stagger: 0.2 } ); // 缓慢呼吸浮动 gsap.to(".hero-float", { y: -10, duration: 4, ease: "sine.inOut", yoyo: true, repeat: -1 }); gsap.to(".hero-breathe", { opacity: 0.35, duration: 3.2, ease: "sine.inOut", yoyo: true, repeat: -1 }); gsap.fromTo( ".hero-hint", { opacity: 0 }, { opacity: 1, duration: 1.5, delay: 2, ease: "power2.out" } ); }, rootRef); return () => ctx.revert(); }, []); return (
Scroll
); }