color c1, c2;
float angle = PI/2;
float angle2 = 0;
void setup() {
size(400, 400);
c2 = color(5, 40, 1); // Define hill colors
c1 = color(116, 247, 105);
}
void draw() {
noLoop();
background(182, 250, 255);
setGradient(0, 300, 400, 300, c1, c2); //Left hill, gradient xpos,ypos,width,height,color1,color2
setGradient2(300, 300, 400, 300, c1, c2); //Right hill, gradient
setGradient3(0, 300, 400, 100, c2, c1);//field, gradient
loop();
pinwheel(200, 200, 1);
pinwheel(350, 130, .25);
pinwheel(50, 125, .25);
}
void pinwheel(int xpos, int ypos, float s) {
stroke(0);
strokeWeight(4);
smooth();
pushMatrix();
translate(xpos, ypos);
angle2 += .1;
scale(s);
line(0, 0, 0, 150);
rotate(angle2);
stroke(0);
strokeWeight(2);
triangle();
rotate(angle);
triangle();
rotate(angle);
triangle();
rotate(angle);
triangle();
popMatrix();
}
void triangle() {
int x = mouseX;
int y = mouseY;
constrain(x,50,150);
constrain(y,0,70);
//fill(108, 72, 255);
fill(x,y,255);
triangle(0, 0, 0, -100, 50, -50);
//fill(54, 17, 206);
fill(x,y,200);
triangle(0, 0, 50, -50, 50, 0);
}
void setGradient(int x, int y, float w, float h, color c1, color c2) {
noFill();
for (int i = y; i <= y+h; i++) {
float inter = map(i, y, y+h, 0, 1);
color c = lerpColor(c1, c2, inter);
stroke(c);
arc(x, i, x+w, i, PI, TWO_PI);//Left hill
}
}
void setGradient3(int x, int y, float w, float h, color c1, color c2) {
noFill();
for (int i = y; i <= y+h; i++) {
float inter = map(i, y, y+h, 0, 1);
color c = lerpColor(c1, c2, inter);
stroke(c);
rect(x, i, w, i+100); //field
}
}
void setGradient2(int x, int y, float w, float h, color c1, color c2) {
noFill();
for (int i = y; i <= y+h; i++) {
float inter = map(i, y, y+h, 0, 1);
color c = lerpColor(c1, c2, inter);
stroke(c);
arc(x+200, i, x+w, i, PI, TWO_PI);//Right hill
}
}