This reference is for Processing 3.0+. If you have a previous version, use the reference included with your software in the Help menu. If you see any errors or have suggestions, please let us know. If you prefer a more technical reference, visit the Processing Core Javadoc and Libraries Javadoc.

Name

camera()

Examples
example pic
size(100, 100, P3D);
noFill();
background(204);
camera(70.0, 35.0, 120.0, 50.0, 50.0, 0.0, 
       0.0, 1.0, 0.0);
translate(50, 50, 0);
rotateX(-PI/6);
rotateY(PI/3);
box(45);
Description Sets the position of the camera through setting the eye position, the center of the scene, and which axis is facing upward. Moving the eye position and the direction it is pointing (the center of the scene) allows the images to be seen from different angles. The version without any parameters sets the camera to the default position, pointing to the center of the display window with the Y axis as up. The default values are camera(width/2.0, height/2.0, (height/2.0) / tan(PI*30.0 / 180.0), width/2.0, height/2.0, 0, 0, 1, 0). This function is similar to gluLookAt() in OpenGL, but it first clears the current camera settings.
Syntax
camera()
camera(eyeX, eyeY, eyeZ, centerX, centerY, centerZ, upX, upY, upZ)
Parameters
eyeX float: x-coordinate for the eye
eyeY float: y-coordinate for the eye
eyeZ float: z-coordinate for the eye
centerX float: x-coordinate for the center of the scene
centerY float: y-coordinate for the center of the scene
centerZ float: z-coordinate for the center of the scene
upX float: usually 0.0, 1.0, or -1.0
upY float: usually 0.0, 1.0, or -1.0
upZ float: usually 0.0, 1.0, or -1.0
Returnsvoid
RelatedbeginCamera()
endCamera()
frustum()
Updated on January 21, 2019 10:05:11am EST

Creative Commons License