BaseCamera is the base class for all Excalibur cameras. Cameras are used to move around your game and set focus. They are used to determine what is "off screen" and can be used to scale the game.
Cameras have a position (x, y) which means they center around a specific point. This can also be an Actor (BaseCamera.setActorToFollow) which the camera will follow as the actor moves, which can be useful for cutscene scenarios (using invisible actors).
To add some fun effects to your game, the shake method will do a random shake. This is great for explosions, damage, and other in-game effects.
"Lerp" is short for Linear Interpolation and it enables the camera focus to move smoothly between two points using timing functions. Use move to ease to a specific point using a provided EasingFunction.
To adjust the zoom for your game, use zoom which will scale the game accordingly. You can pass a duration to transition between zoom levels.
Actors following a path will wobble when camera is moving
Get the camera's x position
Set the camera's x position (cannot be set when following an Actor or when moving)
Get the camera's y position
Set the camera's y position (cannot be set when following an Actor or when moving)
Applies the relevant transformations to the game canvas to "move" or apply effects to the Camera
Canvas context to apply transformations
The number of milliseconds since the last update
Returns the focal point of the camera, a new point giving the x and y position of the camera
Gets the current zoom scale
This moves the camera focal point to the specified position using specified easing function. Cannot move when following an Actor.
The target position to move to
The duration in milliseconds the move should last
Sets the camera to shake at the specified magnitudes for the specified duration
The x magnitude of the shake
The y magnitude of the shake
The duration of the shake in milliseconds
Zooms the camera in or out by the specified scale over the specified duration. If no duration is specified, it take effect immediately.
The scale of the zoom
The duration of the zoom in milliseconds