Coder Social home page Coder Social logo

chathuragh / analog-clock-element Goto Github PK

View Code? Open in Web Editor NEW

This project forked from muan/analog-clock-element

1.0 1.0 0.0 10 KB

A Custom Element for an analog clock.

Home Page: https://muan.github.io/analog-clock-element/

License: MIT License

JavaScript 70.38% HTML 29.62%

analog-clock-element's Introduction

<analog-clock>

A Custom Element for an analog clock.

Attributes

  • mode (string): stopwatch or clock.
  • size (number): Width and height in pixel.
  • marks (number): Number of markings on the edge of the clock for telling the time.
  • ticks (boolean): Whether to display the hour numbers on the dial.

Shadow Parts

  • ::part(tick): The numbers on the dial.
  • ::part(tick): The numbers on the dial.
  • ::part(tick1)...::part(tick12): Each of the nubmers on the dial.
  • ::part(clock): The clock face.
  • ::part(marks): The markings on the edge of the clock.
  • ::part(hand-hour): The hour hand.
  • ::part(hand-minute): The minute hand.
  • ::part(hand-second): The second hand.

Methods

  • analogClock.mode = 'clock'/'stopwatch' switches mode between clock and stopwatch.
  • analogClock.toggleStopwatch() starts and stops the stop watch.
  • analogClock.resetStopwatch() resets stopwatch to 0.
  • analogClock.getTimeElapsed() get time elapsed in ms.

Known issues

In Safari, quickly switching between mode might result in janky animation. Related bug reports:

analog-clock-element's People

Contributors

muan avatar

Stargazers

 avatar

Watchers

 avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.