Lesson 4, Topic 3
In Progress

Challenge: Parting Clouds

john May 24, 2019
Lesson Progress
0% Complete

Cover the sun!

In this challenge, you’ll use your magical programmer powers to create a cloudy sky, and then animate it into a bright and sunny sky.
Start off by changing the position of the clouds so that they cover the sun, but still let a little sun peek out.

Hint: try changing the value of the leftX and rightX variables.

Code

noStroke();
var leftX = 45;
var rightX = 370;
var sunRadius = 100;

draw = function() {
background(184, 236, 255); 
fill(255, 255, 255);
// left cloud
ellipse(leftX, 150, 126, 97);
ellipse(leftX+62, 150, 70, 60);
ellipse(leftX-62, 150, 70, 60);

// right cloud
ellipse(rightX, 100, 126, 97);
ellipse(rightX+62, 100, 70, 60);
ellipse(rightX-62, 100, 70, 60);
};