Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

Using Processing and Python Code. When rain droplets fall into a body of water, they produce a series of seemingly circular ripples that grow and

Using Processing and Python Code.
image text in transcribed
image text in transcribed
When rain droplets fall into a body of water, they produce a series of seemingly circular ripples that grow and expand outward from the point of impact For this question, your job is to write a Processing program that draws a water drop on a lake and its corresponding ripple expanding endlessly outwards The following describes what your program should do. Draw a dark blue background on a 300 x 300 pixel canvas. Draw your water drop as a light blue circle 20 pixels in diameter initially drawn in the centre of the canvas Draw the ripple as a darker shade of blue than the water droplet, but brighter than the background It should be drawn underneath the centre of the water droplet (so we can see the point of impact) but drawn over the background (so we can see the ripple expanding). The ripple's diameter should expand by 1 pixel on every call to draw(). . On a mouse click, move the water droplet's location to the mouse coordinates and restart its ripple animation as if the water droplet fell into the water at that point. Figure 3: Water droplet with its ripple expanding outwards in different locations, The following are some hints as to how to build your program. In particular, you will need to use variables to keep track of various pieces of information for this program. Because the size of the ripple is changing, you will need to continually re-draw both the droplet and the ripple. Therefore, you will need to use two variables to store the current x and y coordinates of the droplet Because the ripple is growing, you will need to use another variable to keep track of the current size lie. diameter) of the ripple. The challenge to this question is to figure out when and how to update the values of the variables men- tioned above. Spend some time planning your approach and think carefully about the behaviour of Pro- cessing's various interactive functions. Python sketch_210209b 18 A Console

Step by Step Solution

There are 3 Steps involved in it

Step: 1

blur-text-image

Get Instant Access to Expert-Tailored Solutions

See step-by-step solutions with expert insights and AI powered tools for academic success

Step: 2

blur-text-image_step_2

Step: 3

blur-text-image_step3

Ace Your Homework with AI

Get the answers you need in no time with our AI-driven, step-by-step assistance

Get Started

Students also viewed these Databases questions