xxxxxxxxxx
var amountt = 50;
var BOX = [];
var capturee;
function setup() {
createCanvas(windowWidth, windowHeight, WEBGL);
randomizee();
capturee = createCapture(VIDEO); // opens up the camera
pixelDensity(1); // turns off oversampling ("retina display")
capturee.size(320, 180); // tin pixels
capturee.hide(); // telling the browser to hide the camera so we can draw it ourselves
}
function draw() {
background(100);
fill(255, 255, 255, 150);
noStroke();
for(let i=0; i<BOX.length; i++)
{
push();
translate(BOX[i].x, BOX[i].y, BOX[i].z);
rotateX(BOX[i].rx);
rotateY(BOX[i].ry);
rotateZ(BOX[i].rz);
texture(capturee);
plane(200);
BOX[i].rx+=0.01;
BOX[i].ry+=0.01;
BOX[i].rz+=0.01;
pop();
}
}
function keyPressed()
{
randomizee();
}
function randomizee() {
BOX = [];
for(let i=0; i<amountt; i++)
{
let b = {};
b.x = random(-width/2, width/2);
b.y = random(-height/2, height/2);
b.z = random(-height/2, height/2);
b.rx = random(100);
b.ry = random(100);
b.rz = random(100);
BOX.push(b);
}
}