Ask Computer Network & Security Expert

Assignment: HTML 5 Canvas, JavaScript and Theory Questions

Assignment Brief:

Develop HTML 5 and JavaScript code to re-create the following vector graphics sequence using appropriate HTML 5 Canvas methods such as:

- beginPath()
- closePath()
- rect()
- arc()
- stroke()
- moveTo()
- lineTo()
- fill()
- ...

Using these methods you will need to draw lines, rectangles, circles (complete arcs) at appropriate co-ordinates using both fillStyle and strokeStyle to reproduce the diagram below.

Note: that when drawing the vector shapes you should use different coordinate variables (var variableName; in JavaScript) to make it easier to keep track of where all the different rectangles, lines and arcs should be placed. For example, it would be wise to keep track of the size of the square with a JavaScript variable such as:

Part A: HTML 5 Canvas Drawing 20%

1. Reproduce the diagram above by defining a canvas object with a width and height of 600 pixels and following the instructions outlined below. In each step be sure to introduce new variables to keep track of things like position, size, and how different objects are offset (differ) from each other.

2. Draw a light green square using code similar to that in Figure 2. The square should have a side length of 300 pixels and should be drawn so that the square is drawn at the center of the canvas as shown in Figure 1.

3. Draw the line objects using the lineTo(), moveTo() and stroke() canvas methods to draw line strokes which create a diamond shape around the canvas. Set the stroke style to black as in Figure 1. The diamond should have four lines on the outside, it should also have lines which converge in the middle (which will later be covered by the center green circle).

4. Fill a complete light green arc (circle) such that the circle is drawn at the center of the canvas with a size less than the width of the rectangle, as shown in Figure 1. Draw a red coloured arc (circle) around the outside of the diamond, as shown in Figure 1. The radius should of the circle should be canvas.width / 2.8

5. Draw filled circles positioned using trigonemtry at diagonal corners of the red circle at the angles of 45°,135°, 225° and 315°. You will be able to calculate the offset (difference) from the center using cos 45° × radius to find the x offset and sin 45° × radius to find the offset for the y position. Remember to use radians!

Part B: Challenge Questions

1. Develop a simple canvas animation of your own design. For example, you could rotate the four circles around the large outside red circle using trigonometry (sin and cos) to locate the x,y coordinates of the circles at different angles. Check that your animation is of an appropriate difficulty level with your lecturer before submitting the assignment.

2. Use Canvas EventListeners to enable user interaction. For example, a user could spin the canvas image using their mouse, buttons and mousedown / mousemove events.

Submission Details and Marking Criteria:

This is an individual assignment. You must work on the individual tasks by yourself and all work on these tasks must be your own. Your final submission should contain the following:
- All the code required to view your animation (your .html file)

Computer Network & Security, Computer Science

  • Category:- Computer Network & Security
  • Reference No.:- M91999828
  • Price:- $75

Priced at Now at $75, Verified Solution

Have any Question?


Related Questions in Computer Network & Security

Security challenges in emerging networksassignment

Security Challenges in Emerging Networks Assignment Description The purpose of this assignment is to develop skills to independently think of innovation. In this assignment students will first learn how to develop knowle ...

Security challenges in emerging networksassignment

Security Challenges in Emerging Networks Assignment Description The purpose of this assignment is to develop skills to independently think of innovation. In this assignment students will first learn how to develop knowle ...

Security challenges in emerging networksassignment

Security Challenges in Emerging Networks Assignment Description The purpose of this assignment is to develop skills to independently think of innovation. In this assignment students will first learn how to develop knowle ...

Security challenges in emerging networksassignment

Security Challenges in Emerging Networks Assignment Description The purpose of this assignment is to develop skills to independently think of innovation. In this assignment students will first learn how to develop knowle ...

Advanced network design assessment - human factors in

Advanced Network Design Assessment - Human factors in network analysis and design Purpose of the assessment - This assignment is designed to assess students' knowledge and skills related to the following learning outcome ...

Advanced network design assessment - human factors in

Advanced Network Design Assessment - Human factors in network analysis and design Purpose of the assessment - This assignment is designed to assess students' knowledge and skills related to the following learning outcome ...

Assignment descriptionproject scope a typical network

Assignment Description Project Scope: A typical network layout diagram of a firm is given below for illustrative purposes only. The service requirements are enclosed. Figure. Network layout of a firm Service requirements ...

Assignment descriptionproject scope a typical network

Assignment Description Project Scope: A typical network layout diagram of a firm is given below for illustrative purposes only. The service requirements are enclosed. Figure. Network layout of a firm Service requirements ...

After reading this weeks materials please respond to two 2

After reading this week's materials, please respond to TWO (2) of the following questions. AND PROVIDE CITATION IN APA 1. Describe the differences between bus, ring, star and mesh topologies. 2. Explain the TCP/IP Model ...

The abstract should not be more than 250 words describe

The abstract should not be more than 250 words. Describe your project, focusing on research questions and research method for next stage of the project. 1. Introduction [The introduction should describe what the project ...

  • 4,153,160 Questions Asked
  • 13,132 Experts
  • 2,558,936 Questions Answered

Ask Experts for help!!

Looking for Assignment Help?

Start excelling in your Courses, Get help with Assignment

Write us your full requirement for evaluation and you will receive response within 20 minutes turnaround time.

Ask Now Help with Problems, Get a Best Answer

Why might a bank avoid the use of interest rate swaps even

Why might a bank avoid the use of interest rate swaps, even when the institution is exposed to significant interest rate

Describe the difference between zero coupon bonds and

Describe the difference between zero coupon bonds and coupon bonds. Under what conditions will a coupon bond sell at a p

Compute the present value of an annuity of 880 per year

Compute the present value of an annuity of $ 880 per year for 16 years, given a discount rate of 6 percent per annum. As

Compute the present value of an 1150 payment made in ten

Compute the present value of an $1,150 payment made in ten years when the discount rate is 12 percent. (Do not round int

Compute the present value of an annuity of 699 per year

Compute the present value of an annuity of $ 699 per year for 19 years, given a discount rate of 6 percent per annum. As