Returns true if the camera is active, else returns false.
This is a read only property. Use camera.on()
and camera.off()
to enable or disable 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.
Scroll around a picture using the mouse, stop scrolling when the left mouse button is down.
// Scroll around a picture using the mouse, stop scrolling when the left mouse button is down. var sprite = createSprite(200, 200); sprite.setAnimation("Chicago_skyline,_viewed_from_John_Hancock_Center.jpg_1"); sprite.scale = 2; camera.off(); function draw() { background("white"); drawSprites(); if (mouseDown("leftButton")) { camera.off(); } if (camera.isActive()) { camera.x = World.mouseX; camera.y = World.mouseY; } }
camera.isActive()
Boolean true or false.
draw()
loop. Found a bug in the documentation? Let us know at documentation@code.org