Question: Using the Following Code please add the following - Add a new function, drawSquare, that takes the canvas, context, and a color as parameters. -

Using the Following Code please add the following

- Add a new function, drawSquare, that takes the canvas, context, and a color as parameters.

- Define the drawSquare function to generate a width between 0 and 40 and coordinates within the canvas

- Use the color as a fillStyle and draw a rectangle using the random values

- Call your new drawSquare from within the artGenerator for loop so that we draw squares and circles.

- Use a random value to decide whether to draw a square or a circle, and change your for loop to use an if/else and draw either a square or a circle for each value of i

---------------------------------------------------------------------------------------------------

Abstract Art Generator

Step by Step Solution

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Databases Questions!