Create animations by defining keyframes for any object property:

// Create a box to animate
const box = BABYLON.MeshBuilder.CreateBox("box", {size: 1}, scene);

// Create an animation for position
const animation = new BABYLON.Animation(
    "positionAnimation",   // Name
    "position.y",          // Property to animate
    30,                     // Frames per second
    BABYLON.Animation.ANIMATIONTYPE_FLOAT, // Type of value
    BABYLON.Animation.ANIMATIONLOOPMODE_CYCLE // Loop mode
);

// Define keyframes
const keyFrames = [];
keyFrames.push({ frame: 0, value: 0 });     // Start at y=0
keyFrames.push({ frame: 30, value: 3 });    // Move to y=3 at frame 30
keyFrames.push({ frame: 60, value: 0 });    // Back to y=0 at frame 60

// Assign keyframes to animation
animation.setKeys(keyFrames);

// Attach animation to the box
box.animations = [animation];

// Start the animation
scene.beginAnimation(box, 0, 60, true); // true = loop