// Cloned by Adrian Irwin on 20 Sep 2022 from World "One Cube World (P5)" by Starter user
// Please leave this clone trail here.
const objectsize = 250; // size of object
const anglechange = 0.01; // how much the rotate angle changes each step
let angle = 0; // rotate angle starts at 0
const noboxes = 1000;
let a = new Array(noboxes);
for(let i = 0; i < noboxes; i++){
a[i] = [ AB.randomIntAtoB(-500,500), AB.randomIntAtoB(-500,500), AB.randomIntAtoB(-500,500) ];
}
const MUSICFILE = '/uploads/starter/SuspenseStrings.mp3';
AB.backgroundMusic ( MUSICFILE );
let img;
function preload(){
img = loadImage ( '/uploads/adrian28/shrek.jpg' );
}
function setup() // "setup" is called once at start of run
{
createCanvas ( ABWorld.fullwidth(), ABWorld.fullheight(), WEBGL );
}
function draw() // "draw" is called every timestep during run
{
background("Crimson"); // background color
// fill("BlueViolet"); // paint box with this color
texture(img);
rotateX(angle); // set each dimension rotation angle to "angle"
rotateY(angle);
rotateZ(angle);
// box(objectsize);
// translate(150, 150, 150);
// box(100, 100, 50); // draw a cube of this size
for (let i = 0; i < noboxes; i++){
translate ( a[i][0], a[i][1], a[i][2] );
box(objectsize);
}
angle = angle + anglechange ; // change angle each step to get rotate movement
}