I’m trying to code something like this –

I’d love to add my coding attempt, only I don’t really have a clue. When googling stuff like “jQuery countdown”, “pie chart” etc. I find only plugins, where I want to code it myself. I’m not even sure whether this should be done with html5 canvas, jQuery or both..
What should be my first step?
Drawing a “pie” section of a circle is a fairly trivial task.
For example:
The above code will draw an arc with a radius of 50 pixels. the forth and fifth parameters determine where the arc starts and ends. In your case, you want:
The variable
pctis the percentage of the circle to be filled.The real objective of your question is the Timer. I’ve created a simple Timer class that is very flexible with its output:
Very basic usage of the Timer class could be something like this:
The nice thing about this Timer implementation is that it isn’t cluttered with logic unrelated to counting down time, so it is very reusable.