Smoothly transition between animations:

// Create a second animation
const animation2 = new BABYLON.Animation(
    "scaleAnimation",
    "scaling",
    30,
    BABYLON.Animation.ANIMATIONTYPE_VECTOR3,
    BABYLON.Animation.ANIMATIONLOOPMODE_CYCLE
);

// Define keyframes for scaling
const scaleKeyFrames = [];
scaleKeyFrames.push({ frame: 0, value: new BABYLON.Vector3(1, 1, 1) });
scaleKeyFrames.push({ frame: 30, value: new BABYLON.Vector3(2, 0.5, 2) });
scaleKeyFrames.push({ frame: 60, value: new BABYLON.Vector3(1, 1, 1) });
animation2.setKeys(scaleKeyFrames);

// Start with position animation
const animatable = scene.beginAnimation(box, 0, 60, true);

// Later, blend to scale animation
setTimeout(() => {
    box.animations = [animation2];
    scene.beginAnimation(box, 0, 60, true, 1.0); // 1.0 = blend speed
}, 3000);