| 374 | |
| 375 | // Animation loop |
| 376 | const animate = () => { |
| 377 | requestAnimationFrame(animate); |
| 378 | material.uniforms.u_time.value += 0.02; // Update time for animation (doubled speed) |
| 379 | material.uniforms.u_viewVector.value = camera.position; |
| 380 | // sphere.rotation.y += 0.004; // Doubled rotation speed |
| 381 | |
| 382 | // Update mouse position in the shader |
| 383 | raycaster.setFromCamera(mouse, camera); |
| 384 | const intersects = raycaster.intersectObject(sphere); |
| 385 | if (intersects.length > 0) { |
| 386 | material.uniforms.u_mouse.value = intersects[0].point; |
| 387 | } |
| 388 | |
| 389 | renderer.render(scene, camera); |
| 390 | }; |
| 391 | |
| 392 | animate(); |
| 393 | |