xxxxxxxxxx
43
var boxSize = 200;
var lineThick = 3;
var rotateRate = .001;
function setup() {
// put setup code here
createCanvas(600, 400, WEBGL);
ortho();
}
function rotateDraw(x, y, depth) {
push();
translate(0, 0, 0);
noFill();
stroke(10);
rotateZ(frameCount * rotateRate);
rotateX(frameCount * rotateRate);
rotateY(frameCount * rotateRate);
box(y, x,depth);
pop();
}
function draw() {
// put drawing code here
background(200,100,20);
noCursor()
let locX = mouseX - height / 2;
let locY = mouseY - width / 2;
strokeWeight(lineThick);
rotateDraw(x=locX, y=locY, depth=boxSize);
}
// When the user clicks the mouse
function mousePressed() {
let locX = mouseX - height / 2;
let locY = mouseY - width / 2;
boxSize = locX
}