Static p5_sys::global::createCamera[][src]

pub static createCamera: CreateCameraInternalType
Expand description

Creates a new p5.Camera object and tells the renderer to use that camera. Returns the p5.Camera object.

Examples

// Creates a camera object and animates it around a box.
let camera;
function setup() {
  createCanvas(100, 100, WEBGL);
  background(0);
  camera = createCamera();
  setCamera(camera);
}

function draw() {
  camera.lookAt(0, 0, 0);
  camera.setPosition(sin(frameCount / 60) * 200, 0, 100);
  box(20);
}