// make an array of random (x,y,z) positions
const noboxes = 10; // how many boxes to have
var a = new Array(noboxes); // array of the box positions
for ( var i=0; i < noboxes; i++ ) // set up the array
{
// a[i] = [10,10,10 ];
a[i] = [ AB.randomIntAtoB(-10,10), AB.randomIntAtoB(-10,10), AB.randomIntAtoB(-10,10) ];
}
var img;
function preload()
{
img = loadImage ( '/uploads/test2/1606057486.png' );
}
// Cloned by test2 on 15 Nov 2020 from World "One Cube World (P5)" by Starter user
// Please leave this clone trail here.
const objectsize = 100; // size of object
const anglechange = .01; // how much the rotate angle changes each step
var angle = .1; // rotate angle starts at 0
function setup() // "setup" is called once at start of run
{
createCanvas ( ABWorld.fullwidth(65), ABWorld.fullheight(6), WEBGL );
}
function draw() // "draw" is called every timestep during run
{
texture(img);
background("cornflowerblue"); // background color
// fill("navy"); // paint box with this color
rotateX(angle); // set each dimension rotation angle to "angle"
rotateY(angle);
rotateZ(angle);
for ( var i=0; i < noboxes; i++ )
{
translate ( AB.randomIntAtoB(-5,1), AB.randomIntAtoB(-5,1), AB.randomIntAtoB(-5,1) ); //a[i] = [ AB.randomIntAtoB(-10,10), AB.randomIntAtoB(-10,10), AB.randomIntAtoB(-10,10) ]; // get box position i
box(objectsize);
}
angle = angle + anglechange ; // change angle each step to get rotate movement
}