From 95685f5b25a7dc628d4cc0330568f6db9ca8b8df Mon Sep 17 00:00:00 2001
From: Fuwn <contact@fuwn.me>
Date: Wed, 3 Apr 2024 18:23:34 -0700
Subject: feat(badge): smoother parallax

---
 src/lib/FallbackBadge.svelte | 8 +++++---
 1 file changed, 5 insertions(+), 3 deletions(-)

(limited to 'src/lib/FallbackBadge.svelte')

diff --git a/src/lib/FallbackBadge.svelte b/src/lib/FallbackBadge.svelte
index 38653881..652c8735 100644
--- a/src/lib/FallbackBadge.svelte
+++ b/src/lib/FallbackBadge.svelte
@@ -30,10 +30,12 @@
 
 	const handleMouseMove = (event: MouseEvent) => {
 		const boundingRectangle = badgeReference.getBoundingClientRect();
-		const factor = 1;
+		const factor = 1.25;
 
-		mouseX = -(event.clientX - boundingRectangle.left - boundingRectangle.width / 2) * factor;
-		mouseY = -(event.clientY - boundingRectangle.top - boundingRectangle.height / 2) * factor;
+		mouseX +=
+			(-(event.clientX - boundingRectangle.left - boundingRectangle.width / 2) - mouseX) * factor;
+		mouseY +=
+			(-(event.clientY - boundingRectangle.top - boundingRectangle.height / 2) - mouseY) * factor;
 	};
 
 	const handleMouseLeave = () => {
-- 
cgit v1.2.3

