// Cloned by barry on 5 Oct 2019 from World "One Cube World (P5)" by Starter user
// Please leave this clone trail here.
const objectsize = 50; // 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/starter/earth.1.jpg" );
}
function setup() {
createCanvas ( ABWorld.fullwidth(), ABWorld.fullheight(), WEBGL );
}
const noSpheres = 10;
var a = new Array(noSpheres);
for ( var i=0; i < noSpheres; i++ ) {
a[i] = [ AB.randomIntAtoB(-200,200), AB.randomIntAtoB(-200,200), AB.randomIntAtoB(-200,200) ];
}
function draw()
{
background("lightblue");
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(objectsize);
}
texture(img);
angle = angle + anglechange ; // change angle each step to get rotate movement
}