import React, { useRef, useMemo } from 'react'; import { Canvas, useFrame } from '@react-three/fiber'; import { Points, PointMaterial, Float } from '@react-three/drei'; import * as THREE from 'three'; import { MotionValue, useTransform } from 'framer-motion'; interface ParticleFieldProps { scrollProgress: MotionValue; } const ParticleField: React.FC = ({ scrollProgress }) => { const ref = useRef(null); const groupRef = useRef(null); // Generate random particles in a sphere const particles = useMemo(() => { const pos = new Float32Array(3000 * 3); for (let i = 0; i < 3000; i++) { const theta = THREE.MathUtils.randFloatSpread(360); const phi = THREE.MathUtils.randFloatSpread(360); const distance = 5 + Math.random() * 5; pos[i * 3] = distance * Math.sin(theta) * Math.cos(phi); pos[i * 3 + 1] = distance * Math.sin(theta) * Math.sin(phi); pos[i * 3 + 2] = distance * Math.cos(theta); } return pos; }, []); useFrame((state, delta) => { if (ref.current) { ref.current.rotation.y += delta / 20; ref.current.rotation.x += delta / 30; } if (groupRef.current) { // Dynamic rotation based on scroll const scroll = scrollProgress.get(); groupRef.current.rotation.z = scroll * Math.PI; groupRef.current.position.z = scroll * 5; } }); return ( ); }; interface NeuralSceneProps { scrollProgress: MotionValue; } const NeuralScene: React.FC = ({ scrollProgress }) => { return (
); }; export default NeuralScene;