Sets the camera offset in the draw state.
- The x offset, in pixels.
- The y offset, in pixels.
Setting a camera offset causes all subsequent draw operations to have their x and y coordinates augmented by the specified amount.
camera() with no arguments resets the camera offset to (0, 0).
Offset values are subtracted from the draw coordinates. If you want the draw operation to occur to the left or below the original coordinates, use a negative offset value.
Camera offsets can be used to implement screen effects such as parallax scrolling (with a different offset per layer) or screen shake (a small random offset per frame).
-- draw a dark blue circle at (20, 20) circfill(20, 20, 10, 1) camera(-2, 2) -- draw a white circle at (22, 18) circfill(20, 20, 10, 7)