Cats (Javascript)
Covers the screen with cats that split it more cats when clicked. (Works in Firefox and Chrome)
Cats = new Array();
var image = Math.floor(Math.random()*5+1); //Assuming you have five jpg that are named 1-5
function point(x,y){
this.x = x;
this.y = y;
}
function full() { return (Cats.length == (window.innerWidth/256 -1)*(window.innerHeight/256 -1)); }
function isSamePoint(p1,p2){return (p1.x == p2.x && p1.y == p2.y )}
function addthings(){
window.setInterval(function () {
if(!full())
document.getElementById("cats").innerHTML = document.getElementById("cats").innerHTML + thing(256,-1,-1);
}, 1000);
}
function rp(x) { var add=x%256/2;return (Math.floor((x/256-1)*Math.random())*256+add);} //Random selection
function lol(id,s,x,y) { //Splits div
if(s==1) return; else s = s / 2;
document.getElementById(id).innerHTML = thing(s,0,0) +
thing(s,s,0) + thing(s,0,s) + thing(s,s,s);}
function thing(s, x , y ){
var id = 100000*Math.random();
if(x==-1) x = rp(window.innerWidth);
if(y==-1) {y = rp(window.innerHeight);
var p = new point(x,y);
for (i=0;i<Cats.length;i++)
if(isSamePoint(Cats[i],p))
if(full()) return "";
else return thing(256,-1,-1);
Cats[Cats.length] = p }
return "<div id=\""+id+"\" style=\"position: absolute; left: " + x +"px; " +
"top: " + y +"px; \"><img onclick=\"lol("+id+","+s+","+x+","+y+")\" width \""+s+"x\" HEIGHT=\""+s+"px\" src=\""+image+".jpg\" /></div>"}
addthings();







