// Cloned by Meenu Mathew on 30 Sep 2021 from World "One Cube World (P5)" by Starter user
// Please leave this clone trail here.
const objectsize = 100; // size of object
const anglechange = 0.05; // how much the rotate angle changes each step
var angle = 0; // rotate angle starts at 0
var img;
const bgmusic ='/uploads/starter/SuspenseStrings.mp3';
//add bg music
AB.backgroundMusic(bgmusic);
function setup() // "setup" is called once at start of run
{
createCanvas ( ABWorld.fullwidth(), ABWorld.fullheight(), WEBGL );
}
/*Called directly before setup(), the preload() function is used to handle asynchronous loading of external files in a blocking way.
If a preload function is defined, setup() will wait until any load calls within have finished.*/
function preload()
{
img=loadImage('uploads/meenumathew/butterfly.jpeg');
}
/*"draw" is called every timestep during run Called directly after setup(),
the draw() function continuously executes the lines of code contained inside its block until the program is stopped or noLoop() is called. */
function draw()
{
background("lightblue"); // background color
//fill("lightpink"); // paint box with this color
texture(img); //fill with image
rotateX(angle); // set each dimension rotation angle to "angle"
rotateY(angle);
rotateZ(angle);
//box(objectsize); // draw a cube of this size
box(200,50,500); // draw a cube of this size box ( width, height, depth );
//to make another object
//translate(x,y,[z])The x parameter specifies left/right translation, the y parameter specifies up/down translation, the z parameter specifies forward/backward translation.
translate(250, 250, 250);
box(objectsize);
angle = angle + anglechange ; // change angle each step to get rotate movement
}