/* In this variant on moving_circles, the circle becomes the sun, and the color of the sun and the background varies with the height of the sun. */ color sunHigh = color(245, 234, 12); // yellow color sunLow = color(234, 148, 7); // orange color skyHigh = color(164, 236, 243); color skyLow = color(211, 136, 165); // This function is executed only once, at the very beginning void setup() { size(500, 400); noStroke(); } // This function is repeatedly call in an implicit loop. // A single call is responsible for drawing a single frame. void draw() { float t = pow(float(mouseY) / height, 4); background(red(skyHigh)*(1-t) + red(skyLow)*t, green(skyHigh)*(1-t) + green(skyLow)*t, blue(skyHigh)*(1-t) + blue(skyLow)*t); fill(red(sunHigh)*(1-t) + red(sunLow)*t, green(sunHigh)*(1-t) + green(sunLow)*t, blue(sunHigh)*(1-t) + blue(sunLow)*t); float r = 50 + t*20; // gets bigger near bottom ellipse(mouseX, mouseY, r, r); }