-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathseals.js
34 lines (30 loc) · 824 Bytes
/
seals.js
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
var delay = 6000;
var inter_delay = 1000;
var count = 0;
function spawn() {
if ( count > 1000) { return; }
var x = Math.round( Math.random() * 90);
var y = Math.round( Math.random() * 90);
var image = document.createElement('img');
image.src = 'seal.png';
image.style.position = "absolute";
image.style.left = x + "%";
image.style.top = y + "%";
image.style.width = '100px';
image.style.height = '100px';
image.onclick = function() {
this.src = 'blood.png';
if ( delay > 100) {
delay = delay * 0.9;
delay = inter_delay * 0.9;
}
count--;
}
var body = document.getElementsByTagName("body")[0];
body.appendChild(image);
window.setTimeout( "spawn()", delay)
count++;
}
window.onload = function() {
setTimeout( "spawn()", delay);
}