Skip to content

Latest commit

 

History

History
32 lines (22 loc) · 542 Bytes

README.md

File metadata and controls

32 lines (22 loc) · 542 Bytes

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()