Skip to content

meteora-digital/throttled-animation-frame

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

11 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

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

About

ES6 class to throttle animation frames

Resources

Stars

Watchers

Forks

Packages

No packages published