Code viewer for World: World View (Task) (clone b...

// Cloned by ca400test 1 on 19 May 2019 from World "World View (Task)" by Alex Murphy 
// Please leave this clone trail here.
 
let fullwidth  = ABWorld.fullwidth();
let fullheight = ABWorld.fullheight();

let theta = 0;

// Load your surfaces in setup()
function setup() {
    createCanvas(fullwidth, fullheight, WEBGL);
    img1 = loadImage( 'uploads/alexmurphy1996/mercury.jpg');
    img2 = loadImage('uploads/alexmurphy1996/world.jpg');
    img3 = loadImage('uploads/alexmurphy1996/neptune.jpg');
    img4 = loadImage('uploads/ca400test1/scared.png');
    img5 = loadImage('uploads/alexmurphy1996/neptune.jpg');
    sun_img = loadImage('uploads/alexmurphy1996/sun_surface.jpg');
}

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

    theta += 5;
}

function solar() {
    planet(20, 300, img1);
    planet(80, 200, img2);
    planet(80, 300, img3);
    planet(100, 500, img4);
    planet(80, 400, img5);
}


// 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();
}