The zoom factor of the camera.
A zoom of 1 is the default, normal size. Setting zoom to 2 will zoom in and make everything twice the size. Setting zoom to 0.5 will zoom out make everything half size. All camera properties can be both accessed and updated.
The camera enables scrolling and zooming for scenes extending beyond the display area. A camera has a position, a zoom factor, and mouse coordinates relative to the view. The camera is automatically created and available for use.
Zoom in and out.
// Zoom in and out. var back = createSprite(200, 200); back.setAnimation("stone_snow_1"); camera.on(); function draw() { background("white"); drawSprites(); if (keyDown("up")) { camera.zoom = camera.zoom - 0.1; } if (keyDown("down")) { camera.zoom = camera.zoom + 0.1; } }
camera.zoom
The zoom factor of the camera.
drawSprites()
is called.Found a bug in the documentation? Let us know at documentation@code.org