Skip to content

Repository files navigation

@dimensionalpocket/fps

build

Frames-per-second counter for Javascript.

Usage

importFpsfrom'@dimensionalpocket/fps'// Initialize a counter with a given sample size in frames.// Default sample size is 60 (1 second).// Larger sizes affect average calculations.constfps=newFps(300)// 5 seconds// Synchronous usage (no await):fps.start()// ... your codefps.stop()// Synchronous or asynchronous:varstartAt=fps.now()// ... your codefps.add(fps.now()-startAt)// Returns the average FPSfps.average()// Usage with reactive libsfps.total// returns the sum of all given valuesfps.size// the sample countfps.total/fps.size// the average valuefps.max// the largest value (resets every 10 iterations)

License

MIT

About

Frames-per-second counter for Javascript

Resources

Stars

0 stars

Watchers

0 watching

Forks

Releases

Used by

Contributors

Languages