0.0.3 • Published 10 years ago
loadings v0.0.3
Loadings
Some canvas loadings like jxnblk/loading
Why canvas?
- Better support for browsers http://caniuse.com/#canvas
- Better performance
- Control via javascript
Usage
npm i loadingsYou can use one of them like require('loadings/lib/dots'), some bundle tools like webpack, would build only the parts you need.
Example
var dots = require('loadings/lib/dots')
function $(id) {
return document.getElementById(id)
}
var s = dots(document.getElementById('dots'))
// when you want to stop
s.stop()API
.dots(parentNode, options)
.bars(parentNode, options)
.wander(parentNode, options)
.spin(parentNode, options)
.spokes(parentNode, options)
.bubbles(parentNode, options)
parentNodethe parentNode for canvas renderoptionsoptional optionsoptions.colorthe fill color for loading regionoptions.durationanmation duration in milisecondoptions.radiusset the radius for animate region, works only withspinbubblesspokes
loading.stop()
stop the animation