-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathscripts.js
52 lines (39 loc) · 1.14 KB
/
scripts.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
// Custom rain
var letters = "cybercorey".split('');
var fontSize = 15;
var width = q.width = window.innerWidth;
var height = q.height = window.innerHeight;
ctx = q.getContext('2d');
var columns = q.width / fontSize;
var chars = []; // init the chars
for (var x = 0; x < columns; x++) {
if (Math.random() > 0.900)
chars[x] = 1
else
chars[x] = q.height
}
function draw() {
ctx.fillStyle = 'rgba(0,0,0, 0.06)';
ctx.fillRect(0, 0, width, height);
// ctx.fillStyle='#'+Math.floor(Math.random()*16777215).toString(16);
ctx.fillStyle = '#428bca';
// loop over the chars
for (var i = 0; i < chars.length; i++) {
var char = chars[i];
var letter = letters[Math.floor(Math.random() * letters.length)];
ctx.fillText(letter, i * fontSize, char * fontSize);
if (char * fontSize > q.height && Math.random() > 0.975) {
chars[i] = 0;
}
chars[i]++;
}
};
setInterval(draw, 50);
window.onresize = function () {
width = q.width = window.innerWidth;
height = q.height = window.innerHeight;
}
window.onload = function () {
date = new Date()
document.getElementById('CopyrightDate').innerHTML = date.getFullYear()
}