1.0.0 • Published 5 years ago

@thibka/fps-meter v1.0.0

Weekly downloads
-
License
ISC
Repository
github
Last release
5 years ago

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