For today's exercise you will write a simple canvas application: an analog timer. You will email me what you have done **by the end of class**. What you need to do is:

- Draw a circle.
- Draw a line from the center of that circle to the 12'clock position.
- Implement a simple animation which erases the whole thing then re-draws it every second, but with the line moving to the next position. That is, make the line move like the second-hand in a clock.

The third point might require some basic geometry. Remember that if *t* is the angle (in radians) then the point (*x*,*y*) in the unit circle (centered at 0,0) that is an angle *t* from (1,0) is given by: *x = cos(t)* and *y = sin(t)*, as illustrated by the diagram you see here.

## No comments:

## Post a Comment