This repository has been archived by the owner on Apr 4, 2020. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathindex.html
91 lines (78 loc) · 2.61 KB
/
index.html
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
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<title>Matrix</title>
<script>
(function(i,s,o,g,r,a,m){i['GoogleAnalyticsObject']=r;i[r]=i[r]||function(){
(i[r].q=i[r].q||[]).push(arguments)},i[r].l=1*new Date();a=s.createElement(o),
m=s.getElementsByTagName(o)[0];a.async=1;a.src=g;m.parentNode.insertBefore(a,m)
})(window,document,'script','https://www.google-analytics.com/analytics.js','ga');
ga('create', 'UA-85436207-1', 'auto');
ga('send', 'pageview');
</script>
<script src="https://ajax.googleapis.com/ajax/libs/jquery/1.11.3/jquery.min.js"></script>
<script>
var characters = [0,1,2,3,4,5,6,7,8,9, 'a', 'b', 'c', 'd', 'e', 'f', 'g', 'h', 'i', 'j', 'k', 'l', 'm', 'n', 'o', 'p', 'q', 'r', 's', 't', 'u', 'v', 'w', 'x', 'y', 'z', 'A', 'B', 'C', 'D', 'E', 'F', 'G', 'H', 'I', 'J', 'K', 'L', 'M', 'N', 'O', 'P', 'Q', 'R', 'S', 'T', 'U', 'V', 'W', 'X', 'Y', 'Z', '!', '@', '#', '$', '%', '^', '&', '*', '(', ')', '\'', '"', ';', ':', ',', '<', '>', '.', '/', '?', '[', ']', '{', '}', '\\', '|', '-', '_', '=', '+', '`', '~']
function randomCharacter() {
// Returns a random character from the array that holds all of the characters used in the matrix
return characters[Math.floor(Math.random() * (characters.length - 0)) + 0];
}
function addCell(columnNum) {
// Adds a cell to the provided column with a random character inside
$("#col" + columnNum).prepend('<p class="cell">' + randomCharacter() + '</p><br/>')
}
function pickColumnNumber() {
// Returns a random column number
return Math.floor(Math.random() * ((Math.floor(window.innerWidth / 10) - 0))) + 0;
}
function startMatrix() {
setInterval(function(){addCell(pickColumnNumber());}, 1);
setInterval(function(){addCell(pickColumnNumber());}, 1);
}
function init() {
// Gets column number from window width
var columns1 = Math.floor(window.innerWidth / 10);
var columns = Math.floor(columns1 - (columns1 / 6))
// Add enough columns to take up full width of window
for (i = 0; i < columns; i++) {
$("#container").prepend('<div id="col' + i + '" class="column"></div>');
}
startMatrix();
}
$(document).ready(function() {
init();
});
</script>
<style>
html, body {
padding: 0;
margin: 0;
width: 100%;
height: 100%;
background: black;
color: lightgreen;
}
#container {
width: 100%;
height: 100%;
}
.column {
width: 10px;
margin: 1px;
height: auto;
float: left;
}
.cell {
width: 10px;
height: 10px;
margin: 0;
font-family: monospace;
font-size: 10px;
}
</style>
</head>
<body>
<div id="container"></div>
</body>
</html>