let fps;
if (!this.lastCalledTime) {
this.lastCalledTime = new Date().getTime();
fps = 0;
}
let delta = (new Date().getTime() - this.lastCalledTime) / 1000;
this.lastCalledTime = new Date().getTime();
fps = Math.ceil((1/delta));
if (this.counterFPS >= 60) {
var sum = this.fpsArray.reduce(function(a,b) { return a + b });
var average = Math.ceil(sum / this.fpsArray.length);
$('#tickRate')[0].innerHTML = parseInt(1000 / average)
console.log(average);
this.counterFPS = 0;
} else {
if (fps !== Infinity) {
this.fpsArray.push(fps);
}
this.counterFPS++;
}