Christopher Wellons fe61295698 Add FPS counter.
2014-06-27 21:50:39 -04:00

30 lines
787 B
JavaScript

/* requestAnimationFrame shim */
if (window.requestAnimationFrame == null) {
window.requestAnimationFrame =
window.webkitRequestAnimationFrame ||
window.mozRequestAnimationFrame ||
function(callback){
window.setTimeout(callback, 1000 / 60);
};
}
function comma(num) {
return num.toString().replace(/(\d)(?=(\d{3})+$)/g, '$1,');
}
var particles = null,
controller = null;
function updateCount() {
var count = particles.statesize[0] * particles.statesize[1];
$('.count').text(comma(count));
}
$(document).ready(function() {
var canvas = $('#display')[0];
particles = new Particles(canvas, 1024 * 16, 3).draw().start();
controller = new Controller(particles);
new FPS(particles);
updateCount();
});