🚀 LEVEL UP TO SENIOR:Unlock 500+ Advanced Practical Challenges & Exercises.
🎓 COURSERA PARTNER:Earn professional Google, Meta, and IBM certificates to supercharge your resume.

Project 24: Rotating Particle Field

3D Engineer
Step 1 of 2
Project

Review: Animated Particles

Rotate an entire particle field slowly over time.

🎯 Your Task

Please add the exact code shown in the light gray box below to your editor.Do not delete your previous code, just insert these new lines in the correct place!

function AnimatedParticles() {
  const ref = useRef();
  const count = 300;
  const positions = new Float32Array(count * 3);
  for (let i = 0; i < count; i++) {
    positions[i * 3] = (Math.random() - 0.5) * 6;
    positions[i * 3 + 1] = (Math.random() - 0.5) * 6;
    positions[i * 3 + 2] = (Math.random() - 0.5) * 6;
  }
  useFrame((state, delta) => {
    ref.current.rotation.y += delta * 0.1;
  });
  return (
    <Points ref={ref} positions={positions}>
      <PointMaterial size={0.05} color="white" />
    </Points>
  );
}

export default function Scene() {
  return (
    <Canvas>
      <AnimatedParticles />
    </Canvas>
  );
}