- 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.
- 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.
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.