new Camera(x, y, zoom)
Look at the Camera reference pages before reading these docs.
A `camera` object is created automatically when p5play loads.
Currently, there can only be one camera per p5.js instance.
A camera facilitates zooming and scrolling for scenes extending beyond
the canvas. Moving the camera does not actually move the sprites.
The camera is automatically created on the first draw cycle.
In p5.js terms the camera wraps the whole drawing cycle in a
transformation matrix but it can be disabled anytime during the draw
cycle to draw interface elements in an absolute position.
Parameters:
Name | Type | Description |
---|---|---|
x |
Number
|
Initial x coordinate |
y |
Number
|
Initial y coordinate |
zoom |
Number
|
magnification |
Members
zoom :Number
Camera zoom.
A scale of 1 will be the normal size. Setting it to 2
will make everything appear twice as big. .5 will make
everything look half size.
Type:
-
Number
Methods
off()
Deactivates the camera.
The canvas will be drawn normally, ignoring the camera's position
and scale until camera.on() is called
on()
Activates the camera.
The canvas will be drawn according to the camera position and scale until
camera.off() is called