system.runTimeout(() => { camera.setCamera("minecraft:free", locationOptions); console.log("Moved camera to new location with easing"); }, 80); // Wait 4 seconds (80 ticks) after first camera change
// Example 3: Set camera rotation with easing constrotationOptions: CameraSetRotOptions = { rotation: { x: -30, y:45 }, // Look down at 30 degrees, turn 45 degrees easeOptions: { easeTime:1.5, easeType:EasingType.InOutQuad, }, };
system.runTimeout(() => { camera.setCamera("minecraft:free", rotationOptions); console.log("Changed camera rotation with easing"); }, 140); // Wait 7 seconds (140 ticks)
// Example 4: Reset to default after demonstration system.runTimeout(() => { constresetEase: EaseOptions = { easeTime:2.0, easeType:EasingType.InOutSine, }; camera.setDefaultCamera("minecraft:first_person", resetEase); console.log("Reset camera to first person view"); }, 10000); // Reset after 10 seconds }); }
// Example: Demonstrate different easing types functiondemonstrateEasingTypes() { constplayer = world.getAllPlayers()[0]; if (!player) return;
constcamera = player.camera; if (!camera.isValid) return;
// Alternate between two camera presets to show the easing effect constpreset = index % 2 === 0 ? "minecraft:third_person_front" : "minecraft:third_person"; camera.setDefaultCamera(preset, easeOptions);
Contains options associated with easing between positions and/or rotations.
Example: cameraEasingExample.ts