1.0.4 • Published 4 years ago

throttled-animation-frame v1.0.4

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

Throttled Animation Frame

An ES6 class to throttle the window.requestAnimationFrame to a specific FPS

Installation

yarn add throttled-animation-frame
npm i throttled-animation-frame

Usage

import ThrottledAnimationFrame from 'throttled-animation-frame';

// We pass in the FPS that we would like our animation to run at.
const animator = new ThrottledAnimationFrame(60);

// Then call the .start() method, passing in the function we would like to run on each frame.
animator.start(() => yourFunction());

// Once we would like to stop the animation, simply call
animator.stop();

License

MIT

throttled-animation-frame