Skip to content

suyXcode/Analog-Watch

Folders and files

NameName
Last commit message
Last commit date

Latest commit

Β 

History

46 Commits
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 

Repository files navigation

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

Preview

Alt Text

βš™οΈ 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().

Architecture

Alt Text

πŸ”„ 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.

πŸ‘¨β€πŸ’» Author

Suyash Singh

πŸ”— GitHub: https://github.com/suyXcode
πŸ’Ό LinkedIn: https://www.linkedin.com/in/suyxcode/
🌐 Portfolio: https://suyxcode.netlify.app

Contributors 2

  •  
  •  

Languages