Search code examples
easeljscreatejs

CreateJS - Measuring FPS in RAF (requestAnimationFrame) mode


I am using CreateJS in the RAF mode

createjs.Ticker.timingMode = createjs.Ticker.RAF;

How do I integrate with for instance stats.js measure the browser's FPS?

Or is there any different, recommended way to measure the FPS with CreateJS?

Thanks!


Solution

  • You should be able to integrate using the instructions on the stats.js GitHub page

    Essentially:

    c.Ticker.on("tick", tick, this);
    function tick(evt) {
       stats.begin();
       // do stuff, like stage.update();
       stats.end();
    }
    

    Alternatively, you could look at Ticker.getMeasuredFPS and Ticker.getMeasuredTickTime.