@thibka/fps-meter

1.0.0 • Public • Published

fps-meter

JS FPS meter. This is an alpha!

Install

npm i @thibka/fps-meter

Usage

This code will display the average FPS in the console every 3 seconds.

import FPSMeter from '@thibka/fps-meter';

function loop() {
    requestAnimationFrame(loop);
    if (FPSMeter.isOn) FPSMeter.update();
}

function initFPSMeter() {
    FPSMeter.start();
    setInterval(function () {
        FPSMeter.calculateMean();
        console.log("FPS: " + FPSMeter.mean);
        FPSMeter.reset();
    }, 3000);
}

initFPSMeter();
loop();

Dependents (0)

Package Sidebar

Install

npm i @thibka/fps-meter

Weekly Downloads

0

Version

1.0.0

License

ISC

Unpacked Size

2.29 kB

Total Files

3

Last publish

Collaborators

  • thibka