rnayyar- Dynamic Drawing; project 3

I had a lot of issues coming up with an idea but looking at my ceiling fan for a little while helped me come to this quirky conclusion. Windmills are neat, I like them a lot, and I was inspired to create this. The mouseX position correlates to the current weather inside the canvas and the mouseY position correlates to the blade speed depending on the weather 🙂
Figuring out how to make the blades go faster took a long time. I tried to make a variable called Windspeed for the “rotate(milli()/1000);” part, and just have it as “rotate(Windspeed);” but that broke my code… and so did many other variations of that variable attempt… So I just had to manually change it with a conditional and by switching 1000 to 500 and 200 depending on the mouseY… That was fun. 
sketch

//Rhea Nayyar
// Section C
//rnayyar@andrew.cmu.edu
//Project 03-C; Dynamic Drawing

function setup() {
    createCanvas(480, 640);
}

function draw() {
	background("SkyBlue"); //sky
   if (mouseX>=150){
     background(105); //cloudy sky
   }
   if(mouseX>=350){
     background(random(80,145)); //stormy sky
   }
  fill('YellowGreen'); //field
  rect(0,400,640,480);
  fill("OliveDrab"); //mountains
  quad(-70,400, 100,400,45,310,-30,390);
  quad(0,400,300,400,100,330,21,400);
  quad(275,400,480,400,480,310,420);
  push();
  translate(width/2,height/2);
  fill('DarkRed'); //Windmill stalk
  quad(-40,0, 30,0, 70, 200, -60,200);
  fill("DimGrey"); //disk behind windmill blades
  ellipse(0,0,50,50);
  fill(0); //door
  stroke('Yellow'); //molding
  rect(-10,150,30,50);
  fill("White"); //windmill blades
  noStroke();
   if (mouseY>=200){
     rotate(millis()/500); //mid-speed (cloudy)
   }
   if (mouseY>=420){
     rotate(millis()/100); //super-speed (stormy)
   }
  rotate(millis()/1000); //regular speed (normal)
  rotate(radians(100));
  quad(0,0,95,0,85,30,10,30);
  rotate(radians(260));
  quad(0,0,95,0,85,30,10,30);
  rotate(radians(270));
  quad(0,0,95,0,85,30,10,30);
  rotate(radians(275));
  quad(0,0,95,0,85,30,10,30);
  pop();
}

Leave a Reply