class arcade.Camera(viewport_width: int = 0, viewport_height: int = 0, window: Optional[arcade.application.Window] = None)[source]#

The Camera class is used for controlling the visible viewport. It is very useful for separating a scrolling screen of sprites, and a GUI overlay. For an example of this in action, see Move with a Scrolling Screen - Centered.

  • viewport_width (int) – Width of the viewport. If not set the window width will be used.

  • viewport_height (int) – Height of the viewport. If not set the window height will be used.

  • window (Window) – Window to associate with this camera, if working with a multi-window program.

move(vector: pyglet.math.Vec2)[source]#

Moves the camera with a speed of 1.0, aka instant move

This is equivalent to calling move_to(my_pos, 1.0)

move_to(vector: pyglet.math.Vec2, speed: float = 1.0)[source]#

Sets the goal position of the camera.

The camera will lerp towards this position based on the provided speed, updating its position everytime the use() function is called.

  • vector (Vec2) – Vector to move the camera towards.

  • speed (Vec2) – How fast to move the camera, 1.0 is instant, 0.1 moves slowly

resize(viewport_width: int, viewport_height: int)[source]#

Resize the camera’s viewport. Call this when the window resizes.

  • viewport_width (int) – Width of the viewport

  • viewport_height (int) – Height of the viewport


Update the projection matrix of the camera. This creates an orthogonal projection based on the viewport size of the camera.

shake(velocity: pyglet.math.Vec2, speed: float = 1.5, damping: float = 0.9)[source]#

Add a camera shake.

  • velocity (Vec2) – Vector to start moving the camera

  • speed (float) – How fast to shake

  • damping (float) – How fast to stop shaking


Update the camera’s viewport to the current settings.


Select this camera for use. Do this right before you draw.

zoom(change: float)[source]#

Zoom the camera in or out. Or not. This will currently raise an error TODO implement