Created
August 17, 2014 11:39
-
-
Save spite/23b083024ad7cc1fad17 to your computer and use it in GitHub Desktop.
Play http://colorrun.pl/ forever
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
var ctx1 = document.getElementById( 'color-1' ).getContext( '2d' ), | |
ctx2 = document.getElementById( 'color-2' ).getContext( '2d' ); | |
function simulateClick( target ) { | |
var evt = document.createEvent("Events"); | |
evt.initEvent("click", true, true); | |
target.dispatchEvent(evt); | |
} | |
setInterval( function() { | |
if( ctx1.fillStyle.indexOf( 'rgba' ) === -1 ) simulateClick( ctx1.canvas ); | |
if( ctx2.fillStyle.indexOf( 'rgba' ) === -1 ) simulateClick( ctx2.canvas ); | |
}, 10 ); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment