Graphic JavaScript


Back to index
Connect the Dots

Your browser does not support the HTML5 canvas tag.

ASSIGNMENT:

Make the following alterations to the sample program:

  1. Create a canvas space 200x200
  2. Create two fixed points to represent the lower two vertices of a triangle. One should be at 20,180 and the other at 180,180.
  3. When the mouse is clicked a third point will move to the location of the click and lines will be drawn between the three points, forming a triangle.
  4. Near each vertex will be a number with a degree sign after it representing the angle of the vertex.
  5. The third point must be at least 20 units from the edge of the canvas area.