Code viewer for World: Clone of Barrys

// Cloned by Brendan on 7 Oct 2019 from World "One Cube World (P5) (clone by barry)" by barry 
// Please leave this clone trail here.
 


// Cloned by barry on 5 Oct 2019 from World "One Cube World (P5)" by Starter user 
// Please leave this clone trail here.
 
 
const maxSize    = 75;      // size of object   

const anglechange   = 0.01;     // how much the rotate angle changes each step 

var angle = 0;                  // rotate angle starts at 0  

var img;

function preload()  {
   img = loadImage (  "/uploads/brendanb/1570456293.png" );
}


function setup() {
  createCanvas ( ABWorld.fullwidth(), ABWorld.fullheight(),  WEBGL );
}


const noSpheres = 8;                 	
var a = new Array(noSpheres);         	

for ( var i=0; i < noSpheres; i++ ) {
     a[i] = [ AB.randomIntAtoB(-200,200), AB.randomIntAtoB(-200,200), AB.randomIntAtoB(-10,10), AB.randomIntAtoB(30,50) ];
}
    a[0] = [0,0,0,maxsize];
    a[1] = [5,AB.randomIntAtoB(-20,20), AB.randomIntAtoB(-10,10),maxsize/20];
    a[2] = [25,AB.randomIntAtoB(-20,20), AB.randomIntAtoB(-10,10),maxsize/15];
    a[3] = [40,AB.randomIntAtoB(-20,20), AB.randomIntAtoB(-10,10),maxsize/15];
    a[4] = [50,AB.randomIntAtoB(-20,20), AB.randomIntAtoB(-10,10),maxsize/15];
    a[5] = [100,AB.randomIntAtoB(-20,20), AB.randomIntAtoB(-10,10),maxsize/4];
    a[6] = [150,AB.randomIntAtoB(-20,20), AB.randomIntAtoB(-10,10),maxsize/3];
    a[7] = [175,AB.randomIntAtoB(-20,20), AB.randomIntAtoB(-10,10),maxsize/15];
    a[8] = [200,AB.randomIntAtoB(-20,20), AB.randomIntAtoB(-10,10),maxsize/20];
    



function draw()         
{
    background("white");    

    for ( var i=0; i < noSpheres; i++ ) {
        translate ( a[i][0], a[i][1], a[i][2] );
        rotateX(angle);             // set each dimension rotation angle to "angle"
        rotateY(angle);
  //      rotateZ(angle);
        
        sphere(a[i][3]);    
    }

    
    texture(img);

    angle = angle + anglechange ;       // change angle each step to get rotate movement        
}