Simplest implementation of blinking:
var frequency = 200;
if (! blinking || Math.floor(Date.now() / frequency) % 2) {
ctx.drawImage(...);
}
So the idea is that if you set blinking
to true
then it will based on time and frequency, blinking it on and off by just drawing or not.