Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

The purpose of today's kb is to create a web application that draws the tree objects to the camas. Instructions: Complete the following lat exercise

image text in transcribedimage text in transcribedimage text in transcribed

The purpose of today's kb is to create a web application that draws the tree objects to the camas. Instructions: Complete the following lat exercise indivdually. Please follow the instructions carefully and complele al of the sleps. Create a basic lab7.howi file and lab7.js flle for the lab. In the html fie there should be a carwas sized nno by 800 Part 1: Write cede that does the following a. Draw a tree on the canvas that locks approximately lke tis. - The tree should be approximately 80 pixels tall. - Use a line to draw the trunk. L. Set the linemath and strokestyle - Draw the green eirele after the trunk. b. Write a function named drawTree(x,y) and adapt your code from above to work inside the furction - Parameters: x and y, which specily the posilion lo draw tre tree. (x,y) should be the center point at the bottom of the tree. (x,y) - Operation: Draw the troe at point (xyy) The tree should be approximately 50 pixels tall. - Returns: nuthung - Tesi the funchion. Part 2: Write code that does the following c. Use a loop and the rolale(j lunclion alung wilh your draw Iree furkction lo draw a circle ol 8 trees centered an the carwas. Each tree should be 100 plxels from the certer point. See the screenshot for Part d to see what this should look like. d. Now wite a function named drawTreeCircle (x,y,r, count) and adapt your code from above to work inside the function - Parameters: x arid y, wtich specily the center point of the tree circle, 1 , the ratius of the orde gdislance Iram the center to the base of the lres, ard cuunt, the rumber ol Irems in the crite - Operation: Agrin, use saived and restored) because the fundion wil be rotating the bral enortinate system - Returns: nothing - Test the function. Cailing drawTroocircle(400,400,100,8) shoukd produce somothing like tris. Part 3. Write cooe that does the followng - Use a loog and your drawTrocCirde() function to draw multiple circios of troos as seen in the screanstial beluw - The innemost circle has a radus of 0 and a count of 8 trees. - Each circle further out has a radius of 100 greater and 8 additional trees. * The second carcle taess radius 100 and count 16 - The third circle has radus 200 and count 24.. Test that your diavastript carrectlly executes for all of the probikms

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: 3

blur-text-image

Ace Your Homework with AI

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

Get Started

Recommended Textbook for

More Books

Students also viewed these Databases questions

Question

List the benefits of strategic planning.

Answered: 1 week ago

Question

When there was controversy, was it clear who had the final say?

Answered: 1 week ago