"use client"; import { useEffect, useRef } from "react"; import { motion, useScroll, useTransform } from "framer-motion"; import gsap from "gsap"; import { ScrollTrigger } from "gsap/ScrollTrigger"; import Image from "next/image"; gsap.registerPlugin(ScrollTrigger); export default function RestaurantStory() { const sectionRef = useRef(null); const parchmentRef = useRef(null); const titleRef = useRef(null); // Framer Motion scroll tracking for simple parallax of background and frames const { scrollYProgress } = useScroll({ target: sectionRef, offset: ["start end", "end start"], }); const yBackground = useTransform(scrollYProgress, [0, 1], ["-10%", "10%"]); const yImage1 = useTransform(scrollYProgress, [0, 1], ["0%", "-15%"]); const yImage2 = useTransform(scrollYProgress, [0, 1], ["10%", "-5%"]); useEffect(() => { const parchment = parchmentRef.current; if (!parchment) return; const ctx = gsap.context(() => { // Vintage paper reveal: expands vertically like a scroll unrolling gsap.fromTo( parchment, { clipPath: "polygon(0 48%, 100% 48%, 100% 52%, 0 52%)", scale: 0.95, }, { clipPath: "polygon(0 0, 100% 0, 100% 100%, 0 100%)", scale: 1, duration: 2, ease: "power3.inOut", scrollTrigger: { trigger: parchment, start: "top 80%", end: "top 30%", scrub: true, }, } ); // Text ink reveal: lines fade and spread slightly on scroll const textLines = parchment.querySelectorAll(".ink-reveal"); textLines.forEach((line) => { gsap.fromTo( line, { opacity: 0.1, filter: "blur(4px)", y: 15 }, { opacity: 1, filter: "blur(0px)", y: 0, duration: 1.2, scrollTrigger: { trigger: line, start: "top 85%", end: "top 60%", scrub: true, }, } ); }); }, parchment); return () => ctx.revert(); }, []); const timelineEvents = [ { year: "1928", title: "The Palace Foundation", text: "Our journey began in a grand Chettinad palace. Built with Burmese teak and Italian marble, the mansion served as a sanctuary of hospitality, welcoming royal emissaries and regional chieftains with legendary feasts.", }, { year: "1972", title: "Preserving Ancient Spices", text: "The royal recipes were transcribed from palm leaves. Master spice-blenders preserved the art of hand-pounding cardamoms, cinnamon, and red sun-dried chilies in stone mortars, ensuring the flavors remained pristine.", }, { year: "2026", title: "The Modern Legacy Sanctuary", text: "Today, My Dosa Place brings this heritage into the modern era. We unite century-old cooking methodologies with contemporary culinary presentation, inviting you to dine like royalty in Waterloo.", }, ]; return (
{/* Traditional Temple Borders */}
{/* Left Side: Vintage Parchment Scroll */}
{/* Distressed Paper Edges and Watermark */}
{/* Brass Corner Accents */}
{/* Scroll Header */}
O U R C H R O N I C L E S

OUR DOSA CHRONICLES

{/* Timeline List */}
{timelineEvents.map((event, idx) => (
{/* Timeline Node Ring */}
{/* Event Meta */}
{event.year}

{event.title}

{/* Event Text */}

{event.text}

))}
{/* Bottom Seal Decoration */}
DR
{/* Right Side: Vintage Framed Pictures with Parallax */}
{/* Framed Image 1: Mansion Detail */} {/* Brass Inner Frame Border */}
Vintage Teak Columns
{/* Title Tag */}
Circa 1928
{/* Framed Image 2: Gopuram Temple Arch styled layout */}
Traditional Serving
{/* Title Tag (Placed outside the clip-path container so it isn't cropped) */}
Royal Dining
{/* Background Ambient Glow */}
{/* SVG ClipPath Definition for the Gopuram Temple Arch frame */}
); }