1.0.5 • Published 6 years ago

anim-countdown v1.0.5

Weekly downloads
4
License
MIT
Repository
github
Last release
6 years ago

Countdown module

features

  • animated time transition
  • isolated blocks
  • supports days,hours,minutes,seconds
  • inititialize with date string or number of seconds
  • react/es6 friends

Install

npm install anim-countdown

Usage

import Countdown from 'anim-countdown';

// init 
var countdown = new Countdown({
  seconds: 71,
  callback: callback
});
  
function callback(){
  console.log("done");
};

// element holder
<div id="seconds-holder-id" />

// add seconds handler
countdown.render('seconds-holder-id', 'seconds');

Initialize Options

  • date - string, YYYY-MM-DD
  • seconds - integer, number of seconds
  • callback - callback function to trigger when finished

Methods

  • .stop() - stop countdown
  • .start() - resume countdown
  • .start() - resume countdown
  • .render(...args) - generate digits block
ArgumentTypeStatusDescription
idstringrequiredid of the element to hold digits block
typestringrequired[dayshoursminutesseconds]
colorstringoptionalcss color will apply to inner parts of digits
rationumberoptionalset auto height based on width of the container
paddingRatioXnumberoptionalhorizontal padding to digit parts
paddingRatioYnumberoptionalvertical padding to digit parts
reduceHeightGapbooleanoptionalbalance vertical gab between digit's parts
  • .redrawBlock(...args) - re draw digits block (ex. use after resize)
ArgumentTypeStatusDescription
idstringrequiredid of the element
  • .redrawAll() - re draw every digits block (ex. use after resize)

  • .updateTime(...args) - reset time

ArgumentTypeStatusDescription
valuestring or numberrequirednumber of seconds or date string YYYY-MM-DD

Preview

Preview image

1.0.5

6 years ago

1.0.4

6 years ago

1.0.3

6 years ago

1.0.2

6 years ago

1.0.1

6 years ago

1.0.0

6 years ago