Get or set the camera's acceleration
Get or set zoom acceleration
Get or set rate of change in zoom, defaults to 0
Direct access to the game object event dispatcher.
Current rotation of the camera
Get or set the camera's velocity
Get or set the camera's angular velocity
Get or set the camera's angular velocity
Get or set the camera's x acceleration
Get or set the camera's x acceleration
Get or set the camera's y acceleration
Get or set the camera's y acceleration
Get or set the camera's x velocity
Get or set the camera's x velocity
Get or set the camera's y velocity
Get or set the camera's y velocity
Gets the bounding box of the viewport of this camera in world coordinates
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)
It is not recommended that internal excalibur methods be overridden, do so at your own risk.
Internal _preupdate handler for onPostUpdate lifecycle event
It is not recommended that internal excalibur methods be overridden, do so at your own risk.
Internal _preupdate handler for onPreUpdate lifecycle event
Adds a new camera strategy to this camera
Instance of an CameraStrategy
Clears all camera strategies from the camera
Applies the relevant transformations to the game canvas to "move" or apply effects to the Camera
Canvas context to apply transformations
Emits a new event
Name of the event to emit
Data associated with this event
Returns the focal point of the camera, a new point giving the x and y position of the camera
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
A [[Promise]] that resolves when movement is finished, including if it's interrupted. The [[Promise]] value is the Vector of the target position. It will be rejected if a move cannot be made.
Alias for removeEventListener
. If only the eventName is specified
it will remove all handlers registered for that specific event. If the eventName
and the handler instance are specified only that handler will be removed.
Event signature
Event signatures
Safe to override onPostUpdate lifecycle event handler. Synonymous with .on('preupdate', (evt) =>{...})
onPostUpdate
is called directly after a scene is updated.
Safe to override onPostUpdate lifecycle event handler. Synonymous with .on('preupdate', (evt) =>{...})
onPostUpdate
is called directly after a scene is updated.
Safe to override onPreUpdate lifecycle event handler. Synonymous with .on('preupdate', (evt) =>{...})
onPreUpdate
is called directly before a scene is updated.
Once listens to an event one time, then unsubscribes from that event
Removes a camera strategy by reference
Instance of an CameraStrategy
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
Cameras
Camera 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.