Update Over Time (uot)
Update Over Time (uot) is a tiny library to provide the easiest way for updating values over time. Provide a callback and a duration you're ready to go!
This utility can be useful for CSS animations, DOM changes, WebGL transitions or anything that can be updated based on a progress value.
It's basically a setTimeout (or setInterval) with progress.
Features:
- Small in size, no dependencies
- Based on requestAnimationFrame
- Optimized for multiple instances
Install
$ npm install --save uot
Usage
Import the library:
;
Provide a callback and a duration:
;
As a third parameter an optional repeat count can be provided.
Use the progress value to update the DOM (or anything):
;
At any given time only a single requestAnimationFrame will be called.
License
MIT © Colin van Eenige