mirror of
https://github.com/skeeto/webgl-particles.git
synced 2026-01-25 16:07:14 +00:00
30 lines
787 B
JavaScript
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();
|
|
});
|