"use client" import { useEffect, useRef } from "react" import Image from "next/image" export default function ParallaxHero() { const parallaxRef = useRef(null) const layersRef = useRef(null) useEffect(() => { if (typeof window === "undefined") return // Función para manejar el scroll parallax const handleScroll = () => { if (!layersRef.current) return const scrolled = window.pageYOffset const rate = scrolled * -0.5 // Aplicar diferentes velocidades a cada capa const layers = [ { selector: '[data-parallax-layer="1"]', speed: 0.5 }, { selector: '[data-parallax-layer="2"]', speed: 0.4 }, { selector: '[data-parallax-layer="3"]', speed: 0.3 }, { selector: '[data-parallax-layer="4"]', speed: 0.2 }, { selector: '[data-parallax-layer="5"]', speed: 0.1 }, ] layers.forEach(({ selector, speed }) => { const elements = layersRef.current?.querySelectorAll(selector) elements?.forEach((element) => { const yPos = scrolled * speed ;(element as HTMLElement).style.transform = `translateY(${yPos}px)` }) }) } // Throttle para mejor rendimiento let ticking = false const throttledScroll = () => { if (!ticking) { requestAnimationFrame(() => { handleScroll() ticking = false }) ticking = true } } // Agregar event listener window.addEventListener("scroll", throttledScroll, { passive: true }) // Limpiar event listener return () => { window.removeEventListener("scroll", throttledScroll) } }, []) return (
Capa parallax 1 Capa parallax 4 Capa parallax 3

Asociación Cultural Sanmartiniana

Cuna de la bandera

Capa parallax 2

La Asociación Cultural Sanmartiniana "Cuna de la Bandera" preserva y difunde el legado del General San Martín a través de recreaciones históricas del Cruce de los Andes, manteniendo viva la memoria de la gesta libertadora.

{/*
*/}
) }