var maxHue = 70;
var currentHue = maxHue;
function setup() {
createCanvas(800,400);
background(100);
colorMode(HSB, 350, 110, 110);
var skyHue = currentHue;
background(22, 0, 20);
}
function draw() {
var c = width / 2;
background(255);
noStroke();
var skyHue = currentHue;
skyHue = map(mouseX, 0, width, 0, 270);
for (var rectY = 0; rectY < 700; rectY += 10) {
fill(skyHue, 50, map(mouseX, 0, width, 100, 0));
rect(0, rectY, width, 250);
skyHue++;
fill(212, 0, 79, 0.08);
rect(0, 400, width, 300);
}
sun();
fill(192,192,192);
triangle(-200, 475, 170, 180, 700, 475);
fill(160, 160, 160);
triangle(80, 400, 680, 230, 900, 400);
}
function sun() {
var diameter = height + 100;
S = map(mouseX, 0, width, 45, 10);
var mouseangle = map(mouseX, 0, width, PI, TWO_PI+ QUARTER_PI);
var d1 = 10 + (sin(mouseangle) * diameter / 2) + diameter / 2;
fill(50, 100, 175);
ellipse(mouseX, d1 - 90, 90, 90);
fill(0, 0, 0,);
}