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

// Cloned by CA400_tst1 on 6 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);
    
    sun_img = loadImage('uploads/alexmurphy1996/sun_surface.jpg');
    p1 = loadImage('uploads/alexmurphy1996/mercury.jpg');
    p2 = loadImage('uploads/alexmurphy1996/venus.jpg');
    p3 = loadImage('uploads/alexmurphy1996/world.jpg');
    p4 = loadImage('uploads/alexmurphy1996/mars.jpg');
    p5 = loadImage('uploads/ca400tst1/smiley.png');
}

// Call your functions in draw()
function draw() {
    background('black');
    sun();
    // Start making planets
    planet(50, 200, p1);
    planet(100, 150, p2);
    planet(150, 300, p5);
    planet(125, 300, p4);
    planet(300, 100, p5);

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