'use client' import { motion, useScroll, useTransform } from 'framer-motion' import { useRef } from 'react' import Link from 'next/link' import Image from 'next/image' const images = [ { src: "https://images.unsplash.com/photo-1541410950669-e771b058097d?q=80&w=2070&auto=format&fit=crop", w: 305, h: 225, tx: -550, ty: -350, rotate: -2 }, { src: "https://images.unsplash.com/photo-1590490360182-c33d57733427?q=80&w=2100&auto=format&fit=crop", w: 325, h: 425, tx: 550, ty: -350, rotate: 1 }, { src: "https://images.unsplash.com/photo-1566665797739-1674de7a421a?q=80&w=2070&auto=format&fit=crop", w: 385, h: 485, tx: -550, ty: 350, rotate: -1 }, { src: "https://images.unsplash.com/photo-1571896349842-33c89424de2d?q=80&w=2073&auto=format&fit=crop", w: 425, h: 365, tx: 550, ty: 350, rotate: 2 }, ] export default function CallToAction({ lang, dict }: { lang: string, dict: any }) { const containerRef = useRef(null) const { scrollYProgress } = useScroll({ target: containerRef, offset: ["start start", "end end"] }) // Title: Stays hit at 0 until scroll hits 30%, then reveals quickly. const entranceOpacity = useTransform(scrollYProgress, [0.85, 0.95, 1], [0, 1, 1]) // Description / Button: Reveals even later, ensuring images are already scattering const textOpacity = useTransform(scrollYProgress, [0.5, 0.7, 1], [0, 1, 1]) const textY = useTransform(scrollYProgress, [0.5, 0.7, 1], [50, 0, 0]) // Scatter range: Images start dispersing at 20% to clear the path for text const scatterRange = [0.2, 0.95] const scatterTLX = useTransform(scrollYProgress, scatterRange, [0, -580]) const scatterTLY = useTransform(scrollYProgress, scatterRange, [0, -380]) const scatterTRX = useTransform(scrollYProgress, scatterRange, [0, 580]) const scatterTRY = useTransform(scrollYProgress, scatterRange, [0, -380]) const scatterBLX = useTransform(scrollYProgress, scatterRange, [0, -580]) const scatterBLY = useTransform(scrollYProgress, scatterRange, [0, 380]) const scatterBRX = useTransform(scrollYProgress, scatterRange, [0, 580]) const scatterBRY = useTransform(scrollYProgress, scatterRange, [0, 380]) const scatterX = [scatterTLX, scatterTRX, scatterBLX, scatterBRX] const scatterY = [scatterTLY, scatterTRY, scatterBLY, scatterBRY] return (
{/* SCATTERING POLAROIDS */} {images.map((img, i) => (
Ayris
))} {/* REVEALING CENTER CONTENT */}

{dict.hero.title}

"{dict.footer.desc}" {dict.footer.book}
) }