Procedural Animation

Create animations directly in code:

// Animate in the render loop
let time = 0;
scene.onBeforeRenderObservable.add(() => {
    time += scene.getEngine().getDeltaTime() / 1000;
    
    // Circular motion
    sphere.position.x = Math.cos(time) * 5;
    sphere.position.z = Math.sin(time) * 5;
    
    // Bobbing motion
    sphere.position.y = 2 + Math.sin(time * 2) * 0.5;
    
    // Continuous rotation
    box.rotation.y += 0.01;
    box.rotation.x = Math.sin(time) * 0.2;
});