// Cloned by James Toolen on 16 Nov 2018 from World "One Cube World (P5)" by Starter user
// Please leave this clone trail here.
var angle = 0; // rotate angle starts at 0
var x = 0;
var y = -100;
var z = 100;
var speed = 3;
const objectsize = 100; // size of object
const anglechange = 0.01; // how much the rotate angle changes each step
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("lightblue"); // background color
fill("navy"); // paint box with this color
rotateX(angle); // set each dimension rotation angle to "angle"
rotateY(angle);
//rotateZ(angle);
//box(objectsize); // draw a cube of this size
angle = angle + anglechange ; // change angle each step to get rotate movement
sphere(40);
fill("yellow");
ellipse(-x,-y,80,50);
ellipse(x,y,80,50);
fill("purple");
ellipse(x,-z,80,50);
ellipse(-x,z,80,50);
if(x > width || y > height){
speed = - 3;
}
if(x < -width || y < -height){
speed = 3;
}
x = x + speed;
y = y + speed;
z = z + speed;
}