Code viewer for World: World View (Task)
let fullwidth  = ABWorld.fullwidth();
let fullheight = ABWorld.fullheight();

let theta = 0;

// Load your surfaces in setup()
function setup() {
    createCanvas(fullwidth, fullheight, WEBGL);
    
    sun_img = loadImage('uploads/alexmurphy1996/sun_surface.jpg');
}

// Call your functions in draw()
function draw() {
    background('black');
    sun();
    // Start making planets


    theta += 5;
}

// View the code below, these are the functions that make the sun and planets

function planet(size, pos, surface) {
    translate(pos, 0);
    push();
    rotateY(theta * 0.001);
    //pass image as texture
    texture(surface);
    sphere(size);
    pop();
}

function sun() {
    translate(-fullwidth/2, 0);
    push();
    rotateY(theta * 0.001);
    rotateX(theta * 0.001);
    rotateZ(theta * 0.001);
    //pass image as texture
    texture(sun_img);
    sphere(180);
    pop();
}