MCPcopy Create free account
hub / github.com/CommandCodeAI/BaseAI / animate

Function animate

apps/baseai.dev/src/components/home/webgl-2024-09-29.tsx:497–511  ·  view source on GitHub ↗
()

Source from the content-addressed store, hash-verified

495
496 // Animation loop
497 const animate = () => {
498 requestAnimationFrame(animate);
499 material.uniforms.u_time.value += 0.01; // Update time for animation
500 material.uniforms.u_viewVector.value = camera.position;
501 sphere.rotation.y += 0.002; // Slow down rotation for better visibility
502
503 // Update mouse position in the shader
504 raycaster.setFromCamera(mouse, camera);
505 const intersects = raycaster.intersectObject(sphere);
506 if (intersects.length > 0) {
507 material.uniforms.u_mouse.value = intersects[0].point;
508 }
509
510 renderer.render(scene, camera);
511 };
512
513 animate();
514

Callers 1

WebGLInitializerFunction · 0.70

Calls

no outgoing calls

Tested by

no test coverage detected