loop-fns
v0.1.3
Published
A lightweight solution for looping with great performance and control.
Downloads
2
Readme
loop-fns
A lightweight solution for looping with great performance and control.
Get started
Install
yarn add loop-fns
# or
npm install --save loop-fns
Use
import { loopFrames } from 'loop-fns'
const props = loopFrames((props) => {
// your graphics update logic...
// you can also control the loop within the callback
if (props.currentFrame === 10) {
props.stop()
}
}, 30) // limit to 30fps
props.start()