Well, when you hold a key on your keyboard, after the first fire there is a 1sec delay.
You can go ahead and open notepad and hold a key (e.x \'x\') you\'ll see after
you could start an event on keydown
and stop it on keyup
$('#mycanvas').on('keydown', function() {
$(document).trigger('start');
});
$('#mycanvas').on('keyup', function() {
$(document).trigger('stop');
});
$(document).on('start', startAnimation);
$(document).on('stop', stopAnimation);
function startAnimation(e) { //start something }
function stopAnimation(e) { //stop something }