1.0.3 • Published 5 months ago

animation-frame-loop v1.0.3

Weekly downloads
-
License
Unlicense (https:...
Repository
github
Last release
5 months ago

Animation Frame Loop

npm version npm downloads bundle size

A small package to keep track of frame related things, most notably deltaTime. Useful when creating animations that need to be consistent with varying frame counts.

Installation

Install using Yarn or NPM, or any other package manager you might prefer.

yarn add animation-frame-loop
npm install animation-frame-loop

Usage

import { AnimationFrameLoop } from "animation-frame-loop"

const loop = new AnimationFrameLoop(({ deltaTime, totalElapsedTime, currentFps }) => {
  // Do your thing
})

// Destroy the loop when you're done
loop.destroy()

deltaTime provides the time between the previous and the current frame. totalElapsedTime provides the total time the loop has run for currentFps provides the frames per second for the current second.

.destroy() can be called to destroy the loop, stopping the callback from being called.

1.0.3

5 months ago

1.0.2

5 months ago

1.0.1

5 months ago

1.0.0

5 months ago