Analog Clock
Copy this iframe to your website:
1 | |
Run the Analog Clock MicroSim in fullscreen
Description
This MicroSim simulates an analog clock face with hour, minute, and second hands. It demonstrates the practical application of trigonometric functions (sine and cosine) to calculate hand positions based on time values.
Key features:
- Real-time clock synchronized to local system time
- Manual mode with sliders to set custom time
- Automatic mode that displays current time
- Visual demonstration of polar-to-Cartesian coordinate conversion
How to Use
- Automatic Mode: Watch the clock display real-time
- Manual Mode: Use the sliders to set hours (0-11), minutes (0-59), and seconds (0-59)
- Switch Mode Button: Toggle between automatic and manual modes
Trigonometry Demonstration
This is a wonderful lab to demonstrate the use of trigonometric functions sine() and cosine(). We ask the question:
Write some code that will take in the seconds as a number from 0 to 59 and return the x and y positions of the tip of the second hand.
1 2 3 4 5 6 | |
Full Program Source
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 | |
Version 2
Version 2 - Blue clock with tick marks
Lesson Plan
Learning Objectives
After completing this lesson, students will be able to:
- Apply sine and cosine functions to convert polar coordinates to Cartesian coordinates
- Explain how angles are mapped from time values to radians
- Modify code parameters to customize clock appearance
Target Audience
- Grade level: High school (grades 9-12)
- Prerequisites: Basic trigonometry (understanding of sine, cosine, and radians)
Activities
- Exploration Activity: Use manual mode to observe how hand positions change with different time values
- Guided Investigation: Calculate the expected (x, y) position for a given second value and verify with the simulation
- Extension Activity: Modify the code to add tick marks or change hand colors
Assessment
- Can students predict the angle of the second hand for a given second value?
- Can students explain why HALF_PI is subtracted in the angle calculation?
- Can students modify the code to display a 24-hour clock face?
References
- p5.js Reference - Documentation for the p5.js library
- Trigonometry for Games - Math is Fun trigonometry tutorial
- Polar Coordinates - Wikipedia article on polar coordinate systems