Analog Watch β Web Application
This project is a simple Analog Watch UI built using HTML, CSS, and JavaScript. The watch dynamically updates every second to show the current time in an analog style.
It demonstrates:
HTML structure for rendering.
CSS for styling and positioning.
JavaScript logic for drawing and updating the clock hands in real time.
π Project Structure
project-root/
β
βββ index.html # Main HTML file with clock UI and logic
βββ README.md # Documentation
βοΈ How It Works
HTML provides the structure and links JavaScript.
CSS applies background, font, and clock container styling.
JavaScript:
Uses the canvas API for drawing.
Draws clock ticks (hours & minutes).
Calculates hour, minute, and second hand positions based on system time.
Updates the UI every second using setInterval().
π Workflow
The page loads β Browser executes index.html.
A styled circular clock face is created with ticks and shadows.
JavaScript retrieves the current time using Date().
The hour, minute, and second hands are drawn using trigonometric calculations (sin & cos).
The clock is updated every second.
π How to Run
Clone or download the project.
git clone <repo-url>
cd project-root
Open index.html in any modern browser.
Youβll see a live Analog Watch running in the center of the page.
πΌοΈ Features
Real-time analog clock with second, minute, and hour hands.
Color-coded hands for better visibility:
Hour hand β Dark blue
Minute hand β Green
Second hand β Red
Decorative ticks and shadows for a polished look.
Fully responsive canvas-based rendering.
π οΈ Technologies Used
HTML5 β Page structure
CSS3 β Styling and layout
JavaScript (ES6) β Clock logic and drawing
Canvas 2D API β Rendering the watch UI
π Notes
The clock runs entirely on the client-side (no backend needed).
Works on all modern browsers.
You can customize colors, sizes, and styles by modifying the CSS and JS values.