1.0.1 • Published 7 years ago

animationthrottle v1.0.1

Weekly downloads
3
License
ISC
Repository
github
Last release
7 years ago

animationthrottle

Install

npm install --save animationthrottle

use

var throttle = require('animationthrottle')

var runInstantly = false
var throttleTime = 200
this.throttledFunction = throttle(function(){
  console.log('I am throttled')
}, throttleTime, runInstantly)

//Inside of the animation loop
function loop(){
  let deltaTime = now - then;
  this.throttledFunction.update(deltaTime)
}

Why

this function does not use setTimeout and thus it needs to be updated in the game loop.

1.0.1

7 years ago

1.0.0

7 years ago