Skip to content

Commit

Permalink
Added rotating camera.
Browse files Browse the repository at this point in the history
  • Loading branch information
0xtimsb committed Apr 27, 2020
1 parent 0ec52f4 commit 7ea0d6d
Showing 1 changed file with 11 additions and 5 deletions.
16 changes: 11 additions & 5 deletions main.js
Original file line number Diff line number Diff line change
Expand Up @@ -15,9 +15,9 @@ let turnQueue = []; // Keep track of turns clicked.
// Settings for cube.
let deltaAngle = 0.25; //0.25 // Radian to be moved.
const wallHeight = 1.01; // Cubie wall height relative to origin.
const wallScale = 0.97; // Cubie wall scale.
const boxFill = 30;
const backgroundFill = 40;
const wallScale = 0.95; // Cubie wall scale.
const boxFill = 0;
const backgroundFill = 20;
const xAxis = new p5.Vector(1, 0, 0);
const yAxis = new p5.Vector(0, 1, 0);
const zAxis = new p5.Vector(0, 0, 1);
Expand All @@ -34,7 +34,7 @@ function preload() {

function setup() {
createCanvas(windowWidth, windowHeight, WEBGL);
easycam = createEasyCam();
//easycam = createEasyCam();

// Construct cube and put it in list.
for (let x = -1; x <= 1; x++) {
Expand All @@ -50,9 +50,15 @@ function windowResized() {
resizeCanvas(windowWidth, windowHeight);
}

let theta = 0;

let status = 'Stable';

function draw() {
background(backgroundFill);
scale(55);
theta += 0.01;
camera(100 * cos(theta), -50, 100 * sin(theta), 0, 0, 0, 0, 1, 0);
scale(10);
drawCube();
updateTurn();
play();
Expand Down

0 comments on commit 7ea0d6d

Please sign in to comment.