Ecosyste.ms: Awesome

An open API service indexing awesome lists of open source software.

Awesome Lists | Featured Topics | Projects

https://github.com/nomeyho/countdown

An SVG countdown component for the Web
https://github.com/nomeyho/countdown

animation component countdown javascript svg web

Last synced: 13 days ago
JSON representation

An SVG countdown component for the Web

Awesome Lists containing this project

README

        

# Countdown
> An SVG countdown component for the Web.

## Demo
[Live demo](https://nomeyho.github.io/countdown/)



## Install
```
npm install @nomeyho/countdown
```

## Usage
Import `countdown.js` and call `countdown(...);` with
a reference to the parent element as first argument.

```html




const container = document.getElementById('container');
countdown(container);

```

## Options
```javascript
countdown(container, {
width = 500,
height = 500,
color = '#888FF7',
strokeWidth = '10px',
onDraw = (i) => console.log(`Drawing ${i}`),
});
```
| Option | Description | Default |
|---|---|---|
| start | The countdown start value (between 10 and 0) | `10` |
| width | The canvas's width in pixels | `500` |
| height | The canva's height in pixels | `500` |
| color | The digit's color | `'#888FF7'` |
| strokeWidth | The digit's stroke width | `'10px'` |
| onDraw | A callback function called after each digit draw | `undefined` |