-
Notifications
You must be signed in to change notification settings - Fork 0
/
index.html
73 lines (73 loc) · 3.04 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
<html>
<head>
<script src="js/EaS.js"></script>
<link rel="stylesheet" href="css/EaS.css">
</head>
<body>
<div class="body">
<div class="screen">
<div id="canvas"></div>
</div>
<div class="nav">
<div class="left">
<div class="up button" onclick="scrollLeftUp()"><div class="arrow"></div></div>
<div class="display" id="drawMode">
<span class="selected" >Classic</span>
<span>Greyscale</span>
<span>Color</span>
</div>
<div class="down button" onclick="scrollLeftDown()"><div class="arrow"></div></div>
</div>
<div class="mid"><div class="reset button" id="reset" onClick="reset()">Reset</div></div>
<div class="right">
<div class="up button" onclick="scrollRightUp()"><div class="arrow"></div></div>
<div class="display" id="drawSize">
<span>8</span>
<span class="selected">16</span>
<span class="">32</span>
<span>64</span>
<span>128</span>
</div>
<div class="down button" onclick="scrollRightDown()"><div class="arrow"></div></div>
</div>
</div>
</div>
<script>
draw();
//Keyboard support easter egg. Click on emptyspace in the page to engage. A/Z to move up and down, N/M to move left and right.
var currentDot;
window.onkeypress = function(e) {
var key = e.keyCode ? e.keyCode : e.which;
var targetDot;
var side = Number(document.querySelector('#drawSize').querySelector('.selected').innerHTML);
if (key == 97) {
if(currentDot >= side) {
targetDot = currentDot -side;
}
}
if (key==122) {
if( currentDot < (side * side - side) ) {
targetDot = currentDot + side;
}
}
if (key==109) {
if(currentDot < ((side * side)-1) ) {
targetDot = currentDot + 1;
}
}
if (key==110) {
if(currentDot>0) {
targetDot = currentDot - 1;
}
}
if (targetDot) {
var drawMode = document.querySelector('#drawMode').querySelector('.selected').innerHTML;
if (drawMode == 'Classic') { keyShade(targetDot); }
if (drawMode == 'Greyscale') { keyGrey(targetDot); }
if (drawMode == 'Color') { keyColor(targetDot); }
currentDot = targetDot;
}
}
</script>
</body>
</html>