Skip to content

[p5.js 2.0 Beta Bug Report]: Update examples that use createCamera() to explicitly call setCamera() #7602

Closed
@Forchapeatl

Description

@Forchapeatl

Most appropriate sub-area of p5.js?

  • Accessibility
  • Color
  • Core/Environment/Rendering
  • Data
  • DOM
  • Events
  • Image
  • IO
  • Math
  • Typography
  • Utilities
  • WebGL
  • Build process
  • Unit testing
  • Internationalization
  • Friendly errors
  • Other (specify if possible)

p5.js version

No response

Web browser and version

No response

Operating system

No response

Steps to reproduce this

Steps:

  1. Build on branch dev-2.0
  2. the camera functions so not work as expected from the reference https://p5js.org/reference/p5/p5.Camera/

Snippet:

let cam;
let delta = 0.001;

function setup() {
  createCanvas(100, 100, WEBGL);

  // Create a p5.Camera object.
  cam = createCamera();

  // Place the camera at the top-center.
  cam.setPosition(0, -400, 800);

  // Point the camera at the origin.
  cam.lookAt(0, 0, 0);

  describe(
    'A white cube on a gray background. The cube goes in and out of view as the camera pans left and right.'
  );
}

function draw() {
  background(200);

  // Turn the camera left and right, called "panning".
  cam.pan(delta);

  // Switch directions every 120 frames.
  if (frameCount % 120 === 0) {
    delta *= -1;
  }

  // Draw the box.
  box();
}

Metadata

Metadata

Assignees

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions