import { useRef, useEffect } from 'react'; import { Canvas, useFrame, useThree } from '@react-three/fiber'; import { OrbitControls, Stars, Float } from '@react-three/drei'; import * as THREE from 'three'; import Characters from './Characters'; // Warm gradient background function WarmBackground() { const { scene } = useThree(); useEffect(() => { // Create gradient texture const canvas = document.createElement('canvas'); canvas.width = 512; canvas.height = 512; const ctx = canvas.getContext('2d')!; const gradient = ctx.createLinearGradient(0, 0, 0, 512); gradient.addColorStop(0, '#FFE5D4'); gradient.addColorStop(0.5, '#FFB4A2'); gradient.addColorStop(1, '#FF8E72'); ctx.fillStyle = gradient; ctx.fillRect(0, 0, 512, 512); const texture = new THREE.TextureLoader().load(canvas.toDataURL()); scene.background = texture; }, [scene]); return null; } // Ground plane with warm color function Ground() { const meshRef = useRef(null); useFrame((state) => { if (meshRef.current) { // Subtle ground animation meshRef.current.rotation.x = -Math.PI / 2; } }); return ( ); } // Floating particles for atmosphere function FloatingParticles({ isCelebrating }: { isCelebrating: boolean }) { const points = useRef(null); const particleCount = isCelebrating ? 200 : 50; const positions = new Float32Array(particleCount * 3); for (let i = 0; i < particleCount; i++) { positions[i * 3] = (Math.random() - 0.5) * 15; positions[i * 3 + 1] = Math.random() * 8; positions[i * 3 + 2] = (Math.random() - 0.5) * 15; } useFrame((state) => { if (points.current) { points.current.rotation.y = state.clock.getElapsedTime() * 0.05; if (isCelebrating) { points.current.rotation.y = state.clock.getElapsedTime() * 0.2; } } }); return ( ); } // Blue lighting setup function Lighting() { return ( <> ); } // Camera animation function CameraController({ isCelebrating }: { isCelebrating: boolean }) { const { camera } = useThree(); useFrame((state) => { const time = state.clock.getElapsedTime(); if (isCelebrating) { // Dramatic camera movement during celebration camera.position.x = Math.sin(time * 0.5) * 2; camera.position.y = 3 + Math.sin(time * 0.3) * 0.5; camera.position.z = 8 + Math.cos(time * 0.5) * 1; } else { // Gentle orbiting before celebration camera.position.x = Math.sin(time * 0.2) * 4; camera.position.z = 8 + Math.cos(time * 0.2) * 2; camera.position.y = 3; } camera.lookAt(0, 1, 0); }); return null; } interface SceneProps { isCelebrating: boolean; } export default function Scene({ isCelebrating }: SceneProps) { return (
{/* Floating decorative elements */}
); }