Code viewer for World: Rotating Cube - by Kline (...

// Cloned by Kline on 20 Sep 2022 from World "Cube (P5)"
// Please leave this clone trail here.
 
const MUSICFILE = '/uploads/kline101/BroPleaseWhyYouDocryingtiktokmemesoundeffect.mp3';
AB.backgroundMusic ( MUSICFILE );
 
var img;

function preload() 
{
   img = loadImage ( '/uploads/kline101/Screenshot2022-09-20at11.42.40.png' );
}


 
const objectsize    = 100;      // size of object   

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

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


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("red");    // background color 
    texture(img);                   // paint box with this color 
           
    rotateX(angle);             // set each dimension rotation angle to "angle"
    rotateY(angle);
    rotateZ(angle);
  
    box(objectsize); 
    translate(250, 250, 250);
    box(objectsize); 


    box(objectsize); 
    translate(250, 250, 250);
    box(objectsize); 




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