kamrify commited on
Commit
5edd378
·
1 Parent(s): b4b2753

Resetting the overlay before drawing and editorconfig

Browse files
Files changed (2) hide show
  1. .editorconfig +8 -0
  2. assets/scripts/src/sholo.js +18 -2
.editorconfig ADDED
@@ -0,0 +1,8 @@
 
 
 
 
 
 
 
 
 
1
+ root = true
2
+
3
+ [*]
4
+ indent_style = space
5
+ indent_size = 2
6
+ end_of_line = lf
7
+ charset = utf-8
8
+ trim_trailing_whitespace = true
assets/scripts/src/sholo.js CHANGED
@@ -7,6 +7,7 @@ function createOverlay() {
7
  overlay = document.createElement('canvas');
8
  overlayContext = overlay.getContext('2d');
9
 
 
10
  overlay.style.background = 'transparent';
11
  overlay.style.position = 'fixed';
12
  overlay.style.top = '0';
@@ -61,6 +62,13 @@ function selectNode(node) {
61
  return;
62
  }
63
 
 
 
 
 
 
 
 
64
  // Cut out the cleared region
65
  overlayContext.clearRect(
66
  currentRegion.left - window.scrollX,
@@ -72,7 +80,15 @@ function selectNode(node) {
72
  document.body.appendChild(overlay);
73
  }
74
 
75
- const nodeToSelect = document.querySelector('.section__header');
 
 
 
76
 
77
  createOverlay();
78
- selectNode(nodeToSelect);
 
 
 
 
 
 
7
  overlay = document.createElement('canvas');
8
  overlayContext = overlay.getContext('2d');
9
 
10
+ overlay.style.pointerEvents = 'none';
11
  overlay.style.background = 'transparent';
12
  overlay.style.position = 'fixed';
13
  overlay.style.top = '0';
 
62
  return;
63
  }
64
 
65
+ const overlayAlpha = 0.7;
66
+
67
+ // Reset the overlay
68
+ overlayContext.clearRect(0, 0, overlay.width, overlay.height);
69
+ overlayContext.fillStyle = `rgba( 0, 0, 0, ${overlayAlpha} )`;
70
+ overlayContext.fillRect(0, 0, overlay.width, overlay.height);
71
+
72
  // Cut out the cleared region
73
  overlayContext.clearRect(
74
  currentRegion.left - window.scrollX,
 
80
  document.body.appendChild(overlay);
81
  }
82
 
83
+ const nodesToSelect = [
84
+ document.querySelector('.section__header'),
85
+ document.querySelector('.section__how'),
86
+ ];
87
 
88
  createOverlay();
89
+
90
+ nodesToSelect.forEach((nodeToSelect, index) => {
91
+ window.setTimeout(() => {
92
+ selectNode(nodeToSelect);
93
+ }, index * 1000);
94
+ });