motion-tween-raf-engine

A FPS based requestAnimationFrame

Usage no npm install needed!

<script type="module">
  import motionTweenRafEngine from 'https://cdn.skypack.dev/motion-tween-raf-engine';
</script>

README

Installation

$ npm install motion-tween-raf-engine --save

Usage

Usage is very straight forward.

import { RAF } from "motion-tween-raf-engine";

const loop = new RAF(frameRate, (time, delta) => {
    // do something
}, autoStart)

loop.start()
loop.stop()
loop.resume()
loop.reset()
  • frameRate: from 1 to 60
  • callback: will receive time and delta
  • autoStart: defaults to true