throttled-animation-frame

1.0.4 • Public • Published

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

Package Sidebar

Install

npm i throttled-animation-frame

Weekly Downloads

1

Version

1.0.4

License

MIT

Unpacked Size

5.47 kB

Total Files

5

Last publish

Collaborators

  • meteora-digital