参考 createCamera()

createCamera()

Creates a new p5.Camera object to use with the framebuffer.

The new camera is initialized with a default position (0, 0, 800) and a default perspective projection. Its properties can be controlled with p5.Camera methods such as myCamera.lookAt(0, 0, 0).

Framebuffer cameras should be created between calls to myBuffer.begin() and myBuffer.end() like so:

let myCamera;

myBuffer.begin();

// Create the camera for the framebuffer.
myCamera = myBuffer.createCamera();

myBuffer.end();

Calling setCamera() updates the framebuffer's projection using the camera. resetMatrix() must also be called for the view to change properly:

myBuffer.begin();

// Set the camera for the framebuffer.
setCamera(myCamera);

// Reset all transformations.
resetMatrix();

// Draw stuff...

myBuffer.end();

示例

Returns

p5.Camera: new camera.
Notice any errors or typos? Please let us know. Please feel free to edit src/webgl/p5.Framebuffer.js and open a pull request!

相关参考