time-accumulator

0.0.0 • Public • Published

time-accumulator

Call a function at a constant rate no matter what the rate the accumulator is called at.

Example

This causes the render function to be called every 5 milliseconds no matter what rate requestAnimationFrame calls accum at:

var timeAccumulator = require("time-accumulator");
var accum = timeAccumulator(5.0);
 
var render = function(elapsed) { /* ... */ };
 
window.requestAnimationFrame(function(elapsed) {
    accum(elapsed, render);
});

Install

With npm do:

npm install time-accumulator

License

MIT

Dependencies (0)

    Dev Dependencies (1)

    Package Sidebar

    Install

    npm i time-accumulator

    Weekly Downloads

    0

    Version

    0.0.0

    License

    MIT

    Last publish

    Collaborators

    • ericlathrop