Browse Source

Lazily implemented help modal

Tyler Hallada 6 years ago
parent
commit
ce38957abe
4 changed files with 108 additions and 1 deletions
  1. 1 0
      README.md
  2. 14 0
      css/style.css
  3. 85 0
      index.html
  4. 8 1
      js/proximity.js

+ 1 - 0
README.md

@@ -39,6 +39,7 @@ Scrolling your mouse will speed up or slow down time.
39 39
 | d     | toggles debug mode (including FPS counter)          |
40 40
 | n     | toggles display of nodes                            |
41 41
 | l     | toggles display of lines                            |
42
+| ?     | toggles display of help modal                       |
42 43
 
43 44
 ### Tweaking
44 45
 

+ 14 - 0
css/style.css

@@ -6,3 +6,17 @@
6 6
 html {
7 7
     overflow: hidden;
8 8
 }
9
+
10
+#help {
11
+  display: flex;
12
+  justify-content: center;
13
+  background-color: black;
14
+  color: white;
15
+  position: absolute;
16
+  top: 0;
17
+  left: 0;
18
+}
19
+
20
+#help table {
21
+  color: white;
22
+}

+ 85 - 0
index.html

@@ -16,6 +16,91 @@
16 16
     <body>
17 17
         <script src="https://cdnjs.cloudflare.com/ajax/libs/pixi.js/4.2.2/pixi.min.js"></script>
18 18
         <script src="js/proximity.js"></script>
19
+        <div id="help" style="display: none;">
20
+          <h2>Help</h2>
21
+          <table>
22
+            <tr>
23
+              <th>Interaction</th>
24
+              <th>Action</th>
25
+            </tr>
26
+            <tr>
27
+              <td>mouse hover</td>
28
+              <td>push points away from cursor</td>
29
+            </tr>
30
+            <tr>
31
+              <td>mouse/touch click and hold</td>
32
+              <td>attract points to cursor, then explode outwards</td>
33
+            </tr>
34
+            <tr>
35
+              <td>mouse wheel scroll down</td>
36
+              <td>slow down time</td>
37
+            </tr>
38
+            <tr>
39
+              <td>mouse wheel scroll up</td>
40
+              <td>speed up time</td>
41
+            </tr>
42
+            <tr>
43
+              <td>left</td>
44
+              <td>hold to restrict points to the left of the screen</td>
45
+            </tr>
46
+            <tr>
47
+              <td>right</td>
48
+              <td>hold to restrict points to the right of the screen</td>
49
+            </tr>
50
+            <tr>
51
+              <td>up</td>
52
+              <td>hold to restrict points to the top of the screen</td>
53
+            </tr>
54
+            <tr>
55
+              <td>down</td>
56
+              <td>hold to restrict points to the bottom of the screen</td>
57
+            </tr>
58
+            <tr>
59
+              <td>1</td>
60
+              <td>makes points move linearly</td>
61
+            </tr>
62
+            <tr>
63
+              <td>2</td>
64
+              <td>makes points meander</td>
65
+            </tr>
66
+            <tr>
67
+              <td>3</td>
68
+              <td>makes points snappy</td>
69
+            </tr>
70
+            <tr>
71
+              <td>4</td>
72
+              <td>makes points bouncy</td>
73
+            </tr>
74
+            <tr>
75
+              <td>5</td>
76
+              <td>makes points elastic</td>
77
+            </tr>
78
+            <tr>
79
+              <td>6</td>
80
+              <td>makes points overshoot</td>
81
+            </tr>
82
+            <tr>
83
+              <td>f</td>
84
+              <td>toggle FPS counter</td>
85
+            </tr>
86
+            <tr>
87
+              <td>d</td>
88
+              <td>toggles debug mode (including FPS counter)</td>
89
+            </tr>
90
+            <tr>
91
+              <td>n</td>
92
+              <td>toggles display of nodes</td>
93
+            </tr>
94
+            <tr>
95
+              <td>l</td>
96
+              <td>toggles display of lines</td>
97
+            </tr>
98
+            <tr>
99
+              <td>?</td>
100
+              <td>toggles this help modal</td>
101
+            </tr>
102
+          </table>
103
+        </div>
19 104
     </body>
20 105
 
21 106
     <!-- Google Analytics -->

+ 8 - 1
js/proximity.js

@@ -761,7 +761,7 @@ document.addEventListener('mouseleave', function (e) {
761 761
 /* KEYBOARD EVENTS */
762 762
 
763 763
 window.addEventListener('keydown', function (e) {
764
-    var i;
764
+    var i, help;
765 765
     if (e.keyCode === 37) { // left
766 766
         pointShiftBiasX = -1;
767 767
     } else if (e.keyCode === 38) { // up
@@ -822,5 +822,12 @@ window.addEventListener('keydown', function (e) {
822 822
         }
823 823
     } else if (e.keyCode === 76) { // l
824 824
         drawLines = !drawLines;
825
+    } else if (e.keyCode === 191) { // ?
826
+        help = document.getElementById('help');
827
+        if (help.style.display === 'none') {
828
+            help.style.display = 'flex';
829
+        } else {
830
+            help.style.display = 'none';
831
+        }
825 832
     }
826 833
 });