Deactivates the camera.
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.
Use camera.on()
to have the display area drawn according to the camera position and scale.
Hold the mouse down to activate the camera and link to the sprite movement.
// Hold the mouse down to activate the camera and link to the sprite movement. var back = createSprite(200, 200); back.setAnimation("stone_snow_1"); back.scale = 3; var sprite = createSprite(200,200); sprite.setAnimation("ladybug_1"); function draw() { background("white"); drawSprites(); if (keyDown("right")) { sprite.x = sprite.x+5; } if (keyDown("left")) { sprite.x = sprite.x-5; } if (mouseDown("leftButton")) { camera.on(); camera.x=sprite.x; camera.y=sprite.y; } else { camera.off(); } }
camera.off();
No return value. Possibly changes output in the display after drawSprites() is called.
draw()
loop. Found a bug in the documentation? Let us know at documentation@code.org