From 19067309b9274eecd54bbe9aeb79483cd26677fb Mon Sep 17 00:00:00 2001 From: bender Date: Wed, 25 Mar 2026 14:15:27 +0000 Subject: [PATCH] Add src/components/ui/horizon-hero-section.tsx --- src/components/ui/horizon-hero-section.tsx | 104 +++++++++++++++++++++ 1 file changed, 104 insertions(+) create mode 100644 src/components/ui/horizon-hero-section.tsx diff --git a/src/components/ui/horizon-hero-section.tsx b/src/components/ui/horizon-hero-section.tsx new file mode 100644 index 0000000..a257360 --- /dev/null +++ b/src/components/ui/horizon-hero-section.tsx @@ -0,0 +1,104 @@ +"use client"; + +import React, { useRef, useEffect } from "react"; +import { gsap } from "gsap"; +import * as THREE from "three"; + +interface HorizonHeroSectionProps { + title: string; + description: string; + className?: string; +} + +const HorizonHeroSection: React.FC = ({ + title, + description, + className, +}) => { + const mountRef = useRef(null); + + useEffect(() => { + if (!mountRef.current) return; + + const currentMount = mountRef.current; + const scene = new THREE.Scene(); + const camera = new THREE.PerspectiveCamera( + 75, + currentMount.clientWidth / currentMount.clientHeight, + 0.1, + 1000 + ); + const renderer = new THREE.WebGLRenderer({ antialias: true, alpha: true }); + + renderer.setSize(currentMount.clientWidth, currentMount.clientHeight); + currentMount.appendChild(renderer.domElement); + + // Example: Add a simple cube + const geometry = new THREE.BoxGeometry(); + const material = new THREE.MeshBasicMaterial({ color: 0x00ff00 }); + const cube = new THREE.Mesh(geometry, material); + scene.add(cube); + + camera.position.z = 5; + + const animate = () => { + requestAnimationFrame(animate); + + cube.rotation.x += 0.01; + cube.rotation.y += 0.01; + + renderer.render(scene, camera); + }; + + animate(); + + // GSAP animation example + gsap.fromTo( + ".hero-content", { opacity: 0, y: 50 }, + { opacity: 1, y: 0, duration: 1.5, ease: "power3.out" } + ); + + const handleResize = () => { + camera.aspect = currentMount.clientWidth / currentMount.clientHeight; + camera.updateProjectionMatrix(); + renderer.setSize(currentMount.clientWidth, currentMount.clientHeight); + }; + + window.addEventListener("resize", handleResize); + + return () => { + window.removeEventListener("resize", handleResize); + if (currentMount.contains(renderer.domElement)) { + currentMount.removeChild(renderer.domElement); + } + renderer.dispose(); + }; + }, []); + + return ( +
+
+
+

+ {title} +

+

+ {description} +

+
+ {/* Placeholder for buttons if needed */} + + +
+
+
+ ); +}; + +export default HorizonHeroSection;