diff --git a/src/components/Hero/HeroParticles.jsx b/src/components/Hero/HeroParticles.jsx new file mode 100644 index 0000000..a5bd0f5 --- /dev/null +++ b/src/components/Hero/HeroParticles.jsx @@ -0,0 +1,41 @@ +import { useRef, useMemo } from 'react' +import { Canvas, useFrame } from '@react-three/fiber' +import * as THREE from 'three' + +const COUNT = 250 + +function Particles() { + const ref = useRef() + const positions = useMemo(() => { + const arr = new Float32Array(COUNT * 3) + for (let i = 0; i < COUNT; i++) { + arr[i * 3] = (Math.random() - 0.5) * 22 + arr[i * 3 + 1] = (Math.random() - 0.5) * 18 + arr[i * 3 + 2] = (Math.random() - 0.5) * 16 + } + return arr + }, []) + + useFrame(({ clock }) => { + if (!ref.current) return + ref.current.rotation.y = clock.getElapsedTime() * 0.03 + ref.current.rotation.x = Math.sin(clock.getElapsedTime() * 0.015) * 0.08 + }) + + return ( + + + + + + + ) +} + +export default function HeroParticles() { + return ( + + + + ) +}