"use client"; import React, { useState, useEffect, useRef } from "react"; import gsap from "gsap"; import { ShimmerText } from "@/animations/Reveal"; import { preload } from "react-dom"; export default function IndexHero() { preload("/images/home-bg-1.webp", { as: "image" }); const [activeSlide, setActiveSlide] = useState(0); const containerRef = useRef(null); // Auto-slide every 7 seconds — slower, more readable, professional pacing useEffect(() => { const interval = setInterval(() => { setActiveSlide((prev) => (prev === 0 ? 1 : 0)); }, 7000); return () => clearInterval(interval); }, []); const handleDotClick = (index: number) => { setActiveSlide(index); }; // GSAP slide transition effect useEffect(() => { if (!containerRef.current) return; // Find the currently active slide inside the container const activeItem = containerRef.current.querySelector(".owl-item.active"); if (!activeItem) return; const heading = activeItem.querySelector(".heading-content"); const text = activeItem.querySelector(".text-content"); if (heading && text) { // Clear previous animations if any gsap.killTweensOf([heading, text]); // Premium elegant reveal with cubic elastic feel gsap.fromTo( heading, { y: 55, opacity: 0, scale: 0.95 }, { y: 0, opacity: 1, scale: 1, duration: 1.1, ease: "power4.out" } ); gsap.fromTo( text, { y: 30, opacity: 0 }, { y: 0, opacity: 1, duration: 0.95, ease: "power3.out", delay: 0.25 } ); } }, [activeSlide]); return (