GithubHelp home page GithubHelp logo

animated-svg-clock's Introduction

Animated SVG clock

Clock
Click the clock to show a github.io-hosted SVG file where JavaScript is executed to show your current time

Technical details

  • CSS-based animation
  • Use JavaScript to set the current time
  • W3C Validation

GitHub usage

JavaScript code of an SVG in <img> will not be executed, the SMIL or CSS-based animation is fine, therefore, what you see on GitHub README.md page is an animated clock starting from 00:00, it basically counts the time you have stayed on the page.

Even if you open the GitHub.com-hosted (not GitHub.io) raw SVG file (here it is) directly in your browser, the JavaScript code will still not be executed due to "Content Security Policy: sandbox" header.

In order to execute the JavaScript code and correctly show the current time, you can:

  • open a USERNAME.github.io-hosted SVG image (here is one) directly in your browser
  • or download the SVG file, then open it directly in your browser
  • or embed it directly (not via <img>) in your website, in USERNAME.github.io or any website that does not have strict Content Security Policy header and does not sanitize custom JavaScript code in SVG

Use it (Markdown, can't set width and height):

![Clock](https://tomchen.github.io/animated-svg-clock/clock.svg "Clock")

Use it (HTML, with width and height set):

<img src="https://tomchen.github.io/animated-svg-clock/clock.svg" alt="Clock" title="Clock" height="200px" width="200px">

Design

Yes it's highly similar to a Swiss railway clock whose design IS COPYRIGHTED.

Credits

By Tom Chen

Inspired by SVG animation: by HackaLittleBit (https://commons.wikimedia.org/wiki/File:Swiss_railway_clock_1.svg), CC-by-sa 4.0, whose original SVG is: by Jahoe (https://commons.wikimedia.org/wiki/File:Swiss_railway_clock.svg), CC-by-sa 3.0 & GFDL

(The current SVG code has significate code change comparing to HackaLittleBit's work, and is using the permissive MIT license)

License

MIT license for the code, but Swiss railway clock DESIGN IS COPYRIGHTED.

animated-svg-clock's People

Contributors

tomchen 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.