-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathmatrix-paint.html
More file actions
152 lines (107 loc) · 2.71 KB
/
matrix-paint.html
File metadata and controls
152 lines (107 loc) · 2.71 KB
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
<!DOCTYPE html>
<html>
<head>
<title></title>
<link href="https://fonts.googleapis.com/css?family=Heebo&display=swap" rel="stylesheet">
<style type="text/css">
body { background-color: #000300; }
span {
user-select: none;
}
#btn-reset {
background : linear-gradient(to bottom, rgb(109, 226, 167) 0%, rgb(71, 136, 67) 100%);
border : 1px solid black;
border-radius : 5px;
box-shadow : 0 1px 0 #f1f1f1 inset;
color : white;
cursor : pointer;
font-family : 'Heebo', sans-serif;
font-size : 16px;
left : 10px;
padding : .5em 1em;
position : absolute;
text-align : center;
top : 10px;
outline : 0 none;
z-index : 2;
}
#btn-reset:hover {
background : linear-gradient(to bottom, rgb(48, 146, 96) 0%, rgb(71, 136, 67) 100%);
box-shadow : 0 -1px 0 #f1f1f1 inset;
}
#content {
color : #65fe65;
font-size : 24px;
font-family : "Matrix Code NFI";
height : 99.2%;
left : 10px;
position : absolute;
top : 0;
width : 99.2%;
word-break : break-all;
}
#content span {
display : inline-block;
filter : brightness(7%);
position : relative;
width : 16px;
}
#content .col {
display : inline-block;
position : relative;
width : 16px;
}
.white {
animation-name: changeBrightness;
animation-duration: 250s;
}
@-webkit-keyframes changeBrightness {
0% { filter: brightness(250%); }
70% { filter: brightness(100%); }
100% { filter: brightness(7%); }
}
</style>
</head>
<body>
<button id="btn-reset" type="button">Esborrar</button>
<div id="content"></div>
<script src="https://code.jquery.com/jquery-3.4.1.min.js" integrity="sha256-CSXorXvZcTkaix6Yvo6HppcZGetbYMGWSFlBw8HfCJo=" crossorigin="anonymous"></script>
<script type="text/javascript">
function getRndInteger(min, max) {
return Math.floor(Math.random() * (max - min + 1) ) + min;
}
$(function() {
$active = false;
var elem = document.getElementById("content");
var characters = 'abcdefghijklmnopkrstuvwxyz1234567890ABCDEFGHIJKLMONPQRSTUVWXYZ';
var charactersLength = characters.length;
var result = '';
for (var i = 0; i < 119; i++) {
result += '<div class="col">';
for (var j = 0; j < 37; j++) {
result += '<span>' + characters.charAt( Math.floor(Math.random() * charactersLength) ) + '</span>';
}
result += '</div>';
}
elem.innerHTML = result;
$("span").hover(function(event) {
if ($active)
{
$span = $(event.currentTarget);
$span.addClass("white");
$span.text( characters.charAt( Math.floor(Math.random() * charactersLength)) );
setTimeout(function() {
$span.removeClass("white");
}, 1000);
}
});
$("span").on("click", function() {
$active = !$active;
});
$("#btn-reset").on("click", function() {
$("span").removeClass("white");
});
});
</script>
</body>
</html>