diff --git a/src/components/RestaurantStory.tsx b/src/components/RestaurantStory.tsx index 05f61ab..40f7b5d 100644 --- a/src/components/RestaurantStory.tsx +++ b/src/components/RestaurantStory.tsx @@ -1,234 +1,342 @@ "use client"; -import { useEffect, useRef } from "react"; +import { 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 + + // High-performance scroll tracking bound to the section's pinning viewport const { scrollYProgress } = useScroll({ target: sectionRef, - offset: ["start end", "end start"], + offset: ["start start", "end end"], }); - const yBackground = useTransform(scrollYProgress, [0, 1], ["-10%", "10%"]); - const yImage1 = useTransform(scrollYProgress, [0, 1], ["0%", "-15%"]); - const yImage2 = useTransform(scrollYProgress, [0, 1], ["10%", "-5%"]); + // Slide 1 (1928) - Active from progress 0.0 to 0.33 + const imgOpacity1 = useTransform(scrollYProgress, [0, 0.25, 0.33, 0.40], [1, 1, 0, 0]); + const imgScale1 = useTransform(scrollYProgress, [0, 0.33], [1.0, 1.08]); + const textOpacity1 = useTransform(scrollYProgress, [0, 0.25, 0.33], [1, 1, 0]); + const textY1 = useTransform(scrollYProgress, [0, 0.25, 0.33], [0, 0, -40]); + const bgYearOpacity1 = useTransform(scrollYProgress, [0, 0.25, 0.33], [0.12, 0.12, 0]); + const bgYearY1 = useTransform(scrollYProgress, [0, 0.33], [0, -80]); - useEffect(() => { - const parchment = parchmentRef.current; - if (!parchment) return; + // Slide 2 (1972) - Active from progress 0.33 to 0.66 + const imgOpacity2 = useTransform(scrollYProgress, [0.25, 0.33, 0.58, 0.66], [0, 1, 1, 0]); + const imgScale2 = useTransform(scrollYProgress, [0.25, 0.33, 0.66], [0.95, 1.0, 1.08]); + const textOpacity2 = useTransform(scrollYProgress, [0.25, 0.33, 0.58, 0.66], [0, 1, 1, 0]); + const textY2 = useTransform(scrollYProgress, [0.25, 0.33, 0.58, 0.66], [40, 0, 0, -40]); + const bgYearOpacity2 = useTransform(scrollYProgress, [0.25, 0.33, 0.58, 0.66], [0, 0.12, 0.12, 0]); + const bgYearY2 = useTransform(scrollYProgress, [0.25, 0.66], [80, -80]); - 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(); - }, []); + // Slide 3 (2026) - Active from progress 0.66 to 1.0 + const imgOpacity3 = useTransform(scrollYProgress, [0.58, 0.66, 0.90], [0, 1, 1]); + const imgScale3 = useTransform(scrollYProgress, [0.58, 0.66, 1.0], [0.95, 1.0, 1.08]); + const textOpacity3 = useTransform(scrollYProgress, [0.58, 0.66, 0.90], [0, 1, 1]); + const textY3 = useTransform(scrollYProgress, [0.58, 0.66, 1.0], [40, 0, 0]); + const bgYearOpacity3 = useTransform(scrollYProgress, [0.58, 0.66, 0.90], [0, 0.12, 0.12]); + const bgYearY3 = useTransform(scrollYProgress, [0.58, 1.0], [80, 0]); 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.", + tag: "Circa 1928", }, { 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.", + tag: "Circa 1972", }, { 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.", + tag: "Royal Dining", }, ]; return (
{/* Traditional Temple Borders */}
-
+ {/* Sticky Pinned Container */} +
- {/* Left Side: Vintage Parchment Scroll */} -
+ {/* Left Side: Gopuram Arched Frame Visual Court */} +
+ + {/* Subtle Outer Temple Halo */} +
+ + {/* Golden Corner Trim Background Shield */} +
+
+
+ + {/* Main Gopuram Image Stack Frame */}
- {/* 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 */} -
+ {/* Image 1: 1928 Mansion */} -
- Traditional Serving -
+ Chettinad Palace Mansion +
+ + {/* Image 2: 1972 Spice Altar */} + + South Indian Traditional Welcome + + + {/* Image 3: 2026 Thali Feast */} + + Royal Feast Banquet + + + {/* Inset Double Border Stroke Overlay */} + + + + +
+ + {/* Active Era Tag Frame (Bottom Overlay) */} +
+ {/* Tag 1 */} + + {timelineEvents[0].tag} + + {/* Tag 2 */} + + {timelineEvents[1].tag} + + {/* Tag 3 */} + + {timelineEvents[2].tag} - - {/* Title Tag (Placed outside the clip-path container so it isn't cropped) */} -
- Royal Dining -
- {/* Background Ambient Glow */} -
+ {/* Right Side: Narrative Parallax Slides */} +
+ + {/* Giant Outline Parallax Background Years */} +
+ + 1928 + + + 1972 + + + 2026 + +
+ + {/* Section Header */} +
+ + O U R C H R O N I C L E S + +

+ DOSA CHRONICLES +

+
+
+ + {/* Interactive Slides Container */} +
+ + {/* Slide 1 */} + +
+ + {timelineEvents[0].year} + + +

+ {timelineEvents[0].title} +

+
+

+ {timelineEvents[0].text} +

+
+ + {/* Slide 2 */} + +
+ + {timelineEvents[1].year} + + +

+ {timelineEvents[1].title} +

+
+

+ {timelineEvents[1].text} +

+
+ + {/* Slide 3 */} + +
+ + {timelineEvents[2].year} + + +

+ {timelineEvents[2].title} +

+
+

+ {timelineEvents[2].text} +

+
+ +
+ + {/* Royal Seal Watermark */} +
+
+ DR +
+
+ + Heritage Sanctuary + +
+ +
+ +
+ {/* SVG ClipPath Definition for the Gopuram Temple Arch frame */} @@ -249,8 +357,6 @@ export default function RestaurantStory() { - -
); }