Code viewer for World: Practice World
/* Initialise any variables. */
var angle = 0;
var img;

/* Initialise any constants. */
const angleChange = 1;
const boxSize = 200;
const radius = 100;

function preload() {
    img = loadImage('/uploads/drummk2/Suiyoubi_No_Kampanella_Utaha.jpg');
}

function setup() {
    /* Initialise the canvas for this world. */
    createCanvas(ABWorld.fullwidth(), ABWorld.fullheight(),  WEBGL);
    
    /* Set the initial angle mode. */
    angleMode(DEGREES);
}

function draw() {
    /* Set the background colour for this world. */
    background('white');
    
    /* Draw a rotating sphere with a pre-defined radius. */
    texture(img);
    rotateY(angle);
    sphere(radius);
    
    /* Draw a rotating cube. */
    translate(300, 0, 0);
    rotateX(angle);
    rotateY(angle);
    rotateZ(angle);
    box(boxSize);
    
    /* Modify the angle of rotation before the next cycle runs. */
    angle += angleChange;
}