enable ghosty cursor
This commit is contained in:
		
							parent
							
								
									112ba443b9
								
							
						
					
					
						commit
						f7e3c0329d
					
				| 
						 | 
					@ -0,0 +1,80 @@
 | 
				
			||||||
 | 
					var cursoreffects = function(e) {
 | 
				
			||||||
 | 
					    "use strict";
 | 
				
			||||||
 | 
					    return e.ghostCursor = function(e) {
 | 
				
			||||||
 | 
					        let t, i, n, o = e && e.element,
 | 
				
			||||||
 | 
					            s = o || document.body,
 | 
				
			||||||
 | 
					            h = window.innerWidth,
 | 
				
			||||||
 | 
					            c = window.innerHeight,
 | 
				
			||||||
 | 
					            l = {
 | 
				
			||||||
 | 
					                x: h / 2,
 | 
				
			||||||
 | 
					                y: h / 2
 | 
				
			||||||
 | 
					            },
 | 
				
			||||||
 | 
					            d = [],
 | 
				
			||||||
 | 
					            r = new Image;
 | 
				
			||||||
 | 
					        r.src = "data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAAwAAAATCAYAAACk9eypAAAAAXNSR0IArs4c6QAAACBjSFJNAAB6JgAAgIQAAPoAAACA6AAAdTAAAOpgAAA6mAAAF3CculE8AAAAhGVYSWZNTQAqAAAACAAFARIAAwAAAAEAAQAAARoABQAAAAEAAABKARsABQAAAAEAAABSASgAAwAAAAEAAgAAh2kABAAAAAEAAABaAAAAAAAAAEgAAAABAAAASAAAAAEAA6ABAAMAAAABAAEAAKACAAQAAAABAAAADKADAAQAAAABAAAAEwAAAAAChpcNAAAACXBIWXMAAAsTAAALEwEAmpwYAAABWWlUWHRYTUw6Y29tLmFkb2JlLnhtcAAAAAAAPHg6eG1wbWV0YSB4bWxuczp4PSJhZG9iZTpuczptZXRhLyIgeDp4bXB0az0iWE1QIENvcmUgNS40LjAiPgogICA8cmRmOlJERiB4bWxuczpyZGY9Imh0dHA6Ly93d3cudzMub3JnLzE5OTkvMDIvMjItcmRmLXN5bnRheC1ucyMiPgogICAgICA8cmRmOkRlc2NyaXB0aW9uIHJkZjphYm91dD0iIgogICAgICAgICAgICB4bWxuczp0aWZmPSJodHRwOi8vbnMuYWRvYmUuY29tL3RpZmYvMS4wLyI+CiAgICAgICAgIDx0aWZmOk9yaWVudGF0aW9uPjE8L3RpZmY6T3JpZW50YXRpb24+CiAgICAgIDwvcmRmOkRlc2NyaXB0aW9uPgogICA8L3JkZjpSREY+CjwveDp4bXBtZXRhPgpMwidZAAABqElEQVQoFY3SPUvDQBgH8BREpRHExYiDgmLFl6WC+AYmWeyLg4i7buJX8DMpOujgyxGvUYeCgzhUQUSKKLUS0+ZyptXh8Z5Ti621ekPyJHl+uftfomhaf9Ei5JyxXKfynyEA6EYcLHpwyflT958GAQ7DTABNHd8EbtDbEH2BD5QEQmi2mM8P/Iq+A0SzszEg+3sPjDnDdVEtQKQbMUidHD3xVzf6A9UDEmEm+8h9KTqTVUjT+vB53aHrCbAPiceYq1dQI1Aqv4EhMll0jzv+Y0yiRgCnLRSYyDQHVoqUXe4uKL9l+L7GXC4vkMhE6eW/AOJs9k583ORDUyXMZ8F5SVHVVnllmPNKSFagAJ5DofaqGXw/gHBYg51dIldkmknY3tguv3jOtHR4+MqAzaraJXbEhqHhcQlwGSOi5pytVQHZLN5s0WNe8HPrLYlFsO20RPHkImxsbmHdLJFI76th7Z4SeuF53hTeFLvhRCJRCTKZKxgdnRDbW+iozFJbBMw14/ElwGYc0egMBMFzT21f5Rog33Z7dX02GBm7WV5ZfT5Nn5bE3zuCDe9UxdTpNvK+5AAAAABJRU5ErkJggg==";
 | 
				
			||||||
 | 
					        const a = window.matchMedia("(prefers-reduced-motion: reduce)");
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					        function A() {
 | 
				
			||||||
 | 
					            if (a.matches) return console.log("This browser has prefers reduced motion turned on, so the cursor did not init"), !1;
 | 
				
			||||||
 | 
					            t = document.createElement("canvas"), i = t.getContext("2d"), t.style.top = "0px", t.style.left = "0px", t.style.pointerEvents = "none", o ? (t.style.position = "absolute", s.appendChild(t), t.width = s.clientWidth, t.height = s.clientHeight) : (t.style.position = "fixed", document.body.appendChild(t), t.width = h, t.height = c), s.addEventListener("mousemove", g), s.addEventListener("touchmove", m, {
 | 
				
			||||||
 | 
					                passive: !0
 | 
				
			||||||
 | 
					            }), s.addEventListener("touchstart", m, {
 | 
				
			||||||
 | 
					                passive: !0
 | 
				
			||||||
 | 
					            }), window.addEventListener("resize", u), p()
 | 
				
			||||||
 | 
					        }
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					        function u(e) {
 | 
				
			||||||
 | 
					            h = window.innerWidth, c = window.innerHeight, o ? (t.width = s.clientWidth, t.height = s.clientHeight) : (t.width = h, t.height = c)
 | 
				
			||||||
 | 
					        }
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					        function m(e) {
 | 
				
			||||||
 | 
					            if (e.touches.length > 0)
 | 
				
			||||||
 | 
					                for (let t = 0; t < e.touches.length; t++) f(e.touches[t].clientX, e.touches[t].clientY, r)
 | 
				
			||||||
 | 
					        }
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					        function g(e) {
 | 
				
			||||||
 | 
					            if (o) {
 | 
				
			||||||
 | 
					                const t = s.getBoundingClientRect();
 | 
				
			||||||
 | 
					                l.x = e.clientX - t.left, l.y = e.clientY - t.top
 | 
				
			||||||
 | 
					            } else l.x = e.clientX, l.y = e.clientY;
 | 
				
			||||||
 | 
					            f(l.x, l.y, r)
 | 
				
			||||||
 | 
					        }
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					        function f(e, t, i) {
 | 
				
			||||||
 | 
					            d.push(new w(e, t, i))
 | 
				
			||||||
 | 
					        }
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					        function p() {
 | 
				
			||||||
 | 
					            ! function() {
 | 
				
			||||||
 | 
					                if (0 != d.length) {
 | 
				
			||||||
 | 
					                    i.clearRect(0, 0, h, c);
 | 
				
			||||||
 | 
					                    for (let e = 0; e < d.length; e++) d[e].update(i);
 | 
				
			||||||
 | 
					                    for (let e = d.length - 1; e >= 0; e--) d[e].lifeSpan < 0 && d.splice(e, 1);
 | 
				
			||||||
 | 
					                    0 == d.length && i.clearRect(0, 0, h, c)
 | 
				
			||||||
 | 
					                }
 | 
				
			||||||
 | 
					            }(), n = requestAnimationFrame(p)
 | 
				
			||||||
 | 
					        }
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					        function y() {
 | 
				
			||||||
 | 
					            t.remove(), cancelAnimationFrame(n), s.removeEventListener("mousemove", g), s.removeEventListener("touchmove", m), s.removeEventListener("touchstart", m), window.addEventListener("resize", u)
 | 
				
			||||||
 | 
					        }
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					        function w(e, t, i) {
 | 
				
			||||||
 | 
					            this.initialLifeSpan = 40, this.lifeSpan = 40, this.position = {
 | 
				
			||||||
 | 
					                x: e,
 | 
				
			||||||
 | 
					                y: t
 | 
				
			||||||
 | 
					            }, this.image = i, this.update = function(e) {
 | 
				
			||||||
 | 
					                this.lifeSpan--;
 | 
				
			||||||
 | 
					                const t = Math.max(this.lifeSpan / this.initialLifeSpan, 0);
 | 
				
			||||||
 | 
					                e.globalAlpha = t, e.drawImage(this.image, this.position.x, this.position.y)
 | 
				
			||||||
 | 
					            }
 | 
				
			||||||
 | 
					        }
 | 
				
			||||||
 | 
					        return a.onchange = () => {
 | 
				
			||||||
 | 
					            a.matches ? y() : A()
 | 
				
			||||||
 | 
					        }, A(), {
 | 
				
			||||||
 | 
					            destroy: y
 | 
				
			||||||
 | 
					        }
 | 
				
			||||||
 | 
					    }, Object.defineProperty(e, "__esModule", {
 | 
				
			||||||
 | 
					        value: !0
 | 
				
			||||||
 | 
					    }), e
 | 
				
			||||||
 | 
					}({});
 | 
				
			||||||
| 
						 | 
					@ -8,4 +8,9 @@
 | 
				
			||||||
        </div>
 | 
					        </div>
 | 
				
			||||||
        {{ partial "footer.html" . -}}
 | 
					        {{ partial "footer.html" . -}}
 | 
				
			||||||
    </body>
 | 
					    </body>
 | 
				
			||||||
 | 
					    <script>
 | 
				
			||||||
 | 
					    window.addEventListener("load", (event) => {
 | 
				
			||||||
 | 
					        new cursoreffects.ghostCursor();
 | 
				
			||||||
 | 
					    });
 | 
				
			||||||
 | 
					    </script>
 | 
				
			||||||
</html>
 | 
					</html>
 | 
				
			||||||
| 
						 | 
					
 | 
				
			||||||
| 
						 | 
					@ -48,4 +48,7 @@
 | 
				
			||||||
 | 
					
 | 
				
			||||||
    <!-- Self-hosted analytics -->
 | 
					    <!-- Self-hosted analytics -->
 | 
				
			||||||
    <script async defer data-website-id="a790c0da-a30d-4224-909a-0ac50eaad3b6" data-do-not-track="true" src="https://umami.secluded.site/script.js"></script>
 | 
					    <script async defer data-website-id="a790c0da-a30d-4224-909a-0ac50eaad3b6" data-do-not-track="true" src="https://umami.secluded.site/script.js"></script>
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					    <!-- Funny cursor -->
 | 
				
			||||||
 | 
					    <script async src="/js/ghostCursor.js"></script>
 | 
				
			||||||
</head>
 | 
					</head>
 | 
				
			||||||
| 
						 | 
					
 | 
				
			||||||
		Loading…
	
		Reference in New Issue