summaryrefslogtreecommitdiff
path: root/index.html
diff options
context:
space:
mode:
Diffstat (limited to 'index.html')
-rw-r--r--index.html22
1 files changed, 15 insertions, 7 deletions
diff --git a/index.html b/index.html
index 949b29e..2eda64d 100644
--- a/index.html
+++ b/index.html
@@ -151,14 +151,22 @@
151 } 151 }
152 } 152 }
153 153
154 var lastX = 0;
155 var lastY = 0;
156
154 function moveTrail(e) { 157 function moveTrail(e) {
155 for (let i = 0; i < path.length; i++) { 158 if (lastX !== e.pageX || lastY !== e.pageY) {
156 setTimeout(function() { 159 for (let i = 0; i < path.length; i++) {
157 path[i].style.top = (e.clientY) + 'px'; 160 setTimeout(function() {
158 path[i].style.left = (e.clientX) + 'px'; 161 path[i].style.top = (e.pageY) + 'px';
159 }, i * delay); 162 path[i].style.left = (e.pageX) + 'px';
160 } 163 }, i * delay);
161} 164 }
165 }
166
167 lastX = e.pageX;
168 lastY = e.pageY;
169 }
162 170
163 document.addEventListener('mousemove', moveTrail); 171 document.addEventListener('mousemove', moveTrail);
164 createMouseTrail(); 172 createMouseTrail();