function Strobo() {
this.clearCanvas = function() { document.body.innerHTML = ""; };
this.backup = document.body.innerHTML;
this.strobes = []; // End of strobes array
this.stop = function() {
this.strobes.map(function(strobe) { clearInterval(strobe); });
document.body.innerHTML = this.backup;
}; // End of stop
this.party = function() {
this.strobes[0] = setInterval(function(){ document.body.style.background = "#FFFFFF"; }, 5);
this.strobes[1] = setInterval(function(){ document.body.style.background = "#FF0000"; }, 10);
this.strobes[2] = setInterval(function(){ document.body.style.background = "#00FF00"; }, 15);
this.strobes[3] = setInterval(function(){ document.body.style.background = "#0000FF"; }, 20);
this.strobes[4] = setInterval(function(){ document.body.style.background = "#000000"; }, 25);
}; // End of party function
// Init function
this.init = function() {
this.clearCanvas();
this.party();
}; // End of init
} // End of strobo constructor
// AND YOU INITIALIZE IT WITH...
var strobo = new Strobo();
strobo.init();
// THEN YOU STOP IT WITH...
strobo.stop();
Fire a fun epileptic multi-colour stroboscope in your browser.
Be the first to comment
You can use [html][/html], [css][/css], [php][/php] and more to embed the code. Urls are automatically hyperlinked. Line breaks and paragraphs are automatically generated.