I’m measuring the performance of an animation.
enter image description here
When i use the following code to measure FPS, it’s inconsistent with Chrome Frame rendering stats.
var lastTime = performance.now();
var frame = 0;
var lastFameTime = performance.now();
var loop = function(time) {
var now = performance.now();
var fs = (now - lastFameTime);
lastFameTime = now;
var fps = Math.round(1000/fs);
frame++;
if (now > 1000 + lastTime) {
var fps = Math.round( ( frame * 1000 ) / ( now - lastTime ) );
frame = 0;
lastTime = now;
};
window.requestAnimFrame(loop);
}
How can I get the same stats as Chrome Frame rendering stats?
I expect to get a method for measuring animation performance.
New contributor
myLi is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
Check out our Code of Conduct.