diff --git a/src/components/FloatingScene/FloatingScene.jsx b/src/components/FloatingScene/FloatingScene.jsx new file mode 100644 index 0000000..e0c6e9e --- /dev/null +++ b/src/components/FloatingScene/FloatingScene.jsx @@ -0,0 +1,168 @@ +import { useRef, useMemo } from 'react' +import { Canvas, useFrame } from '@react-three/fiber' +import { motion } from 'framer-motion' +import * as THREE from 'three' + +function FloatingTorus({ position, speed, phase }) { + const ref = useRef() + useFrame(({ clock }) => { + const t = clock.getElapsedTime() + ref.current.rotation.x = t * speed * 0.4 + phase + ref.current.rotation.y = t * speed * 0.6 + phase + ref.current.position.y = position[1] + Math.sin(t * 0.6 + phase) * 0.3 + }) + return ( + + + + + ) +} + +function FloatingIcosahedron({ position, speed, phase }) { + const ref = useRef() + useFrame(({ clock }) => { + const t = clock.getElapsedTime() + ref.current.rotation.x = t * speed * 0.5 + phase + ref.current.rotation.z = t * speed * 0.3 + phase + ref.current.position.y = position[1] + Math.sin(t * 0.5 + phase) * 0.35 + }) + return ( + + + + + ) +} + +function FloatingSphere({ position, speed, phase }) { + const ref = useRef() + useFrame(({ clock }) => { + const t = clock.getElapsedTime() + ref.current.rotation.y = t * speed * 0.4 + ref.current.position.y = position[1] + Math.sin(t * 0.7 + phase) * 0.25 + }) + return ( + + + + + ) +} + +function FloatingOctahedron({ position, speed, phase }) { + const ref = useRef() + useFrame(({ clock }) => { + const t = clock.getElapsedTime() + ref.current.rotation.x = t * speed * 0.6 + phase + ref.current.rotation.y = t * speed * 0.4 + phase + ref.current.position.y = position[1] + Math.sin(t * 0.8 + phase) * 0.3 + }) + return ( + + + + + ) +} + +function FloatingDodecahedron({ position, speed, phase }) { + const ref = useRef() + useFrame(({ clock }) => { + const t = clock.getElapsedTime() + ref.current.rotation.y = t * speed * 0.35 + phase + ref.current.rotation.z = t * speed * 0.25 + phase + ref.current.position.y = position[1] + Math.sin(t * 0.55 + phase) * 0.28 + }) + return ( + + + + + ) +} + +function SceneParticles() { + const ref = useRef() + const positions = useMemo(() => { + const arr = new Float32Array(400 * 3) + for (let i = 0; i < 400; i++) { + arr[i * 3] = (Math.random() - 0.5) * 28 + arr[i * 3 + 1] = (Math.random() - 0.5) * 10 + arr[i * 3 + 2] = (Math.random() - 0.5) * 12 + } + return arr + }, []) + useFrame(({ clock }) => { + if (ref.current) ref.current.rotation.y = clock.getElapsedTime() * 0.015 + }) + return ( + + + + + + + ) +} + +function Scene() { + return ( + <> + + + + + + + + + + + + + {/* Small accent shapes */} + + + + + ) +} + +export default function FloatingScene() { + return ( +
+
+ + + + + {/* Overlay text */} +
+ + Sound In Space + + + Music Has Shape + +
+ + {/* Fade top/bottom */} +
+
+
+ ) +}