forked from karpathy/ulogme
-
Notifications
You must be signed in to change notification settings - Fork 14
/
all-easter-eggs.js
221 lines (211 loc) · 6.17 KB
/
all-easter-eggs.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
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
"use strict";
let kirby = function() {
var shock = document.createElement("div");
var img = new Image();
img.src = "./images/kirby.gif";
img.style.width = "350px";
img.style.height = "300px";
img.style.transition = "6s all linear";
img.style.position = "fixed";
img.style.left = "-400px";
img.style.bottom = "0px";
img.style.zIndex = 999999;
document.body.appendChild(img);
window.setTimeout(function() {
img.style.left = "calc(100% + 500px)";
}, 50);
window.setTimeout(function() {
img.parentNode.removeChild(img);
}, 6000);
};
let mario = function() {
var shock = document.createElement("div");
var img = new Image();
img.src = "./images/mario.gif";
img.style.width = "350px";
img.style.height = "300px";
img.style.transition = "6s all linear";
img.style.position = "fixed";
img.style.left = "-400px";
img.style.bottom = "calc(-50% + 330px)";
img.style.zIndex = 999999;
document.body.appendChild(img);
window.setTimeout(function() {
img.style.left = "calc(100% + 500px)";
}, 50);
window.setTimeout(function() {
img.parentNode.removeChild(img);
}, 6000);
};
var pikachu = function() {
var shock = document.createElement("div");
var img = new Image();
img.src = "./images/pikachu.gif";
img.style.width = "250px";
img.style.height = "149px";
img.style.transition = "1s all";
img.style.position = "fixed";
img.style.left = "calc(50% - 125px)";
img.style.bottom = "-149px";
img.style.zIndex = 999999;
document.body.appendChild(img);
window.setTimeout(function() {
img.style.bottom = "0px";
}, 50);
window.setTimeout(function() {
shock.style.width = "100%";
shock.style.height = "100%";
shock.style.left = 0;
shock.style.top = 0;
shock.style.position = "fixed";
shock.style.zIndex = 9999999;
shock.style.background = "#fffb95";
shock.style.opacity = 0;
document.body.appendChild(shock);
for (var x = 0; x < 81; x++) {
(function(x) {
window.setTimeout(function() {
if (x % 2 === 0) {
shock.style.opacity = 0;
} else {
shock.style.opacity = 0.3;
}
}, x * 25);
})(x);
}
}, 2500);
window.setTimeout(function() {
img.style.bottom = "-149px";
}, 4300);
window.setTimeout(function() {
img.parentNode.removeChild(img);
shock.parentNode.removeChild(shock);
}, 5400);
};
let pikarun = function() {
var shock = document.createElement("div");
var img = new Image();
img.src = "./images/running-pikachu.gif";
img.style.width = "450px";
img.style.height = "350px";
img.style.transition = "4s all";
img.style.position = "fixed";
img.style.left = "-400px";
img.style.bottom = "calc(-50% + 320px)";
img.style.zIndex = 999999;
document.body.appendChild(img);
window.setTimeout(function() {
img.style.left = "calc(100% + 500px)";
}, 50);
window.setTimeout(function() {
img.parentNode.removeChild(img);
}, 4300);
};
var piqiu = function() {
var shock = document.createElement("div");
var img = new Image();
img.src = "./images/piqiu.gif";
img.style.width = "374px";
img.style.height = "375px";
img.style.transition = "13s all";
img.style.position = "fixed";
img.style.right = "-374px";
img.style.bottom = "calc(-50% + 320px)";
img.style.zIndex = 999999;
document.body.appendChild(img);
window.setTimeout(function() {
img.style.right = "calc(100% + 500px)";
}, 50);
window.setTimeout(function() {
img.parentNode.removeChild(img);
}, 10300);
};
let pokeball = function() {
var shock = document.createElement("div");
var img = new Image();
img.src = "./images/pokeball.gif";
img.style.width = "500px";
img.style.height = "350px";
img.style.transition = "8s all linear";
img.style.position = "fixed";
img.style.left = "-450px";
img.style.bottom = "-10px";
img.style.zIndex = 999999;
document.body.appendChild(img);
window.setTimeout(function() {
img.style.left = "calc(100% + 500px)";
}, 50);
window.setTimeout(function() {
img.parentNode.removeChild(img);
}, 8000);
};
var psyduck = function() {
var shock = document.createElement("div");
var img = new Image();
img.src = "./images/psyduck.gif";
img.style.width = "500px";
img.style.height = "500px";
img.style.transition = "1s all";
img.style.position = "fixed";
img.style.left = "calc(50% - 250px)";
img.style.bottom = "-600px";
img.style.zIndex = 999999;
document.body.appendChild(img);
window.setTimeout(function() {
img.style.bottom = "0px";
}, 30);
window.setTimeout(function() {
img.style.bottom = "-600px";
}, 4300);
window.setTimeout(function() {
img.parentNode.removeChild(img);
shock.parentNode.removeChild(shock);
}, 5400);
};
var salamander = function() {
var shock = document.createElement("div");
var img = new Image();
img.src = "./images/salamander.gif";
img.style.width = "374px";
img.style.height = "375px";
img.style.transition = "13s all";
img.style.position = "fixed";
img.style.right = "-374px";
img.style.bottom = "calc(-50% + 320px)";
img.style.zIndex = 999999;
document.body.appendChild(img);
window.setTimeout(function() {
img.style.right = "calc(100% + 500px)";
}, 50);
window.setTimeout(function() {
img.parentNode.removeChild(img);
}, 10300);
};
var snorlax = function() {
var shock = document.createElement("div");
var img = new Image();
img.src = "./images/snorlax.gif";
img.style.width = "374px";
img.style.height = "375px";
img.style.transition = "13s all";
img.style.position = "fixed";
img.style.right = "-374px";
img.style.bottom = "-10px";
img.style.zIndex = 999999;
document.body.appendChild(img);
window.setTimeout(function() {
img.style.right = "calc(100% + 500px)";
}, 50);
window.setTimeout(function() {
img.parentNode.removeChild(img);
}, 10300);
};
// 5% chance of seeing a random egg
var probaOfRandomEgg = 0.05;
var aRandomEasterEgg = function(proba) {
if (Math.random() < (probaOfRandomEgg || probaOfRandomEgg)) {
var allEasterEggs = [ kirby, mario, pikachu, pikarun, piqiu, pokeball, psyduck, salamander, snorlax ];
var randomEasterEgg = allEasterEggs[Math.floor(Math.random() * allEasterEggs.length)];
randomEasterEgg();
};
};