1 float angle = 0; 2 3 void setup() { size(800, 600); 4 5} 6 7 9 10 11 12 13 14 23 24 25 26 27 28 29 void draw() { background(135, 206, 235); // sky blue background 15 16 17 18 strokeWeight(2); 19 rect(width/2-10, height/2-200, 20, 200); 20 21 22 30 31 32 33 34 35 36 } wwwwww // Draw grass fill(124, 252, 0); noStroke(); rect(0, height/2, width, height/2); // Draw windmill tower fill(139, 69, 19); stroke(0); // Draw windmill blades pushMatrix(); translate(width/2, height/2-200); rotate(radians (angle)); fill (255, 215, 0); // blade color noStroke(); triangle(-25, 0, 0, -150, 25, 0); rotate (radians (120)); triangle(-25, 0, 0, -150, 25, 0); rotate(radians (120)); triangle(-25, 0, 0, -150, 25, 0); popMatrix(); // Update blade angle angle += 5;

Database System Concepts
7th Edition
ISBN:9780078022159
Author:Abraham Silberschatz Professor, Henry F. Korth, S. Sudarshan
Publisher:Abraham Silberschatz Professor, Henry F. Korth, S. Sudarshan
Chapter1: Introduction
Section: Chapter Questions
Problem 1PE
icon
Related questions
Question

Answer the given question with a proper explanation and step-by-step solution.

 can you modify the code below with processing 3 application so that the windmill changes color when the user presses any key. Also can you add a ball bouncing in the code also. 

1
float angle = 0;
2
4
5}
3 void setup() {
size(800, 600);
6
7
8
9
15
16
10
11
12 noStroke();
13
14
void draw() {
background(135, 206, 235); // sky blue background
30
31
// Draw grass
fill(124, 252, 0);
32
33
34
35
36 }
333
17
18
strokeWeight(2);
19 rect(width/2-10, height/2-200, 20, 200);
20
21 // Draw windmill blades
22
pushMatrix();
23 translate(width/2, height/2-200);
rotate(radians (angle));
24
25
fill(255, 215, 0); // blade color
noStroke();
26
27
triangle(-25, 0, 0, -150, 25, 0);
rotate (radians (120));
28
29
triangle(-25, 0, 0, -150, 25, 0);
rotate(radians (120));
triangle(-25, 0, 0, -150, 25, 0);
popMatrix();
rect(0, height/2, width, height/2);
// Draw windmill tower
fill(139, 69, 19);
stroke(0);
// Update blade angle
angle += 5;
Transcribed Image Text:1 float angle = 0; 2 4 5} 3 void setup() { size(800, 600); 6 7 8 9 15 16 10 11 12 noStroke(); 13 14 void draw() { background(135, 206, 235); // sky blue background 30 31 // Draw grass fill(124, 252, 0); 32 33 34 35 36 } 333 17 18 strokeWeight(2); 19 rect(width/2-10, height/2-200, 20, 200); 20 21 // Draw windmill blades 22 pushMatrix(); 23 translate(width/2, height/2-200); rotate(radians (angle)); 24 25 fill(255, 215, 0); // blade color noStroke(); 26 27 triangle(-25, 0, 0, -150, 25, 0); rotate (radians (120)); 28 29 triangle(-25, 0, 0, -150, 25, 0); rotate(radians (120)); triangle(-25, 0, 0, -150, 25, 0); popMatrix(); rect(0, height/2, width, height/2); // Draw windmill tower fill(139, 69, 19); stroke(0); // Update blade angle angle += 5;
Expert Solution
steps

Step by step

Solved in 3 steps

Blurred answer
Knowledge Booster
Passing Array as Argument
Learn more about
Need a deep-dive on the concept behind this application? Look no further. Learn more about this topic, computer-science and related others by exploring similar questions and additional content below.
Similar questions
Recommended textbooks for you
Database System Concepts
Database System Concepts
Computer Science
ISBN:
9780078022159
Author:
Abraham Silberschatz Professor, Henry F. Korth, S. Sudarshan
Publisher:
McGraw-Hill Education
Starting Out with Python (4th Edition)
Starting Out with Python (4th Edition)
Computer Science
ISBN:
9780134444321
Author:
Tony Gaddis
Publisher:
PEARSON
Digital Fundamentals (11th Edition)
Digital Fundamentals (11th Edition)
Computer Science
ISBN:
9780132737968
Author:
Thomas L. Floyd
Publisher:
PEARSON
C How to Program (8th Edition)
C How to Program (8th Edition)
Computer Science
ISBN:
9780133976892
Author:
Paul J. Deitel, Harvey Deitel
Publisher:
PEARSON
Database Systems: Design, Implementation, & Manag…
Database Systems: Design, Implementation, & Manag…
Computer Science
ISBN:
9781337627900
Author:
Carlos Coronel, Steven Morris
Publisher:
Cengage Learning
Programmable Logic Controllers
Programmable Logic Controllers
Computer Science
ISBN:
9780073373843
Author:
Frank D. Petruzella
Publisher:
McGraw-Hill Education