From 2982ca71c2f7c4d89937c9b33c1916c6087e0ca6 Mon Sep 17 00:00:00 2001 From: abhiramtx <7253115-abhiramtx@users.noreply.replit.com> Date: Sun, 9 Nov 2025 00:27:08 +0000 Subject: [PATCH] Add a smooth, animated dot cursor that follows the mouse Adds a custom cursor with smooth animation using JavaScript and CSS, updates card backgrounds to #0a0a0a, and increases navigation bar button margins. Replit-Commit-Author: Agent Replit-Commit-Session-Id: 75bceff7-98f2-4f6e-ae8e-e735399a1fe8 Replit-Commit-Checkpoint-Type: full_checkpoint Replit-Commit-Event-Id: 20f129c4-266a-489a-9b78-af922ec1dcda Replit-Commit-Screenshot-Url: https://storage.googleapis.com/screenshot-production-us-central1/d0a1d46d-d203-4308-bc6a-312ac7c0243b/75bceff7-98f2-4f6e-ae8e-e735399a1fe8/mApn6AR --- attached_assets/image_1762647890379.png | Bin 0 -> 1561 bytes static/css/styles.css | 32 ++++++++++++- static/js/scripts.js | 59 ++++++++++++++++++++++++ 3 files changed, 89 insertions(+), 2 deletions(-) create mode 100644 attached_assets/image_1762647890379.png diff --git a/attached_assets/image_1762647890379.png b/attached_assets/image_1762647890379.png new file mode 100644 index 0000000000000000000000000000000000000000..1f74dbfc113fa8ab9530ac0d1b07d59e445ac910 GIT binary patch literal 1561 zcmcIk`BTyf6vrzwOY_)t$<;zYD#hDL()CyrzJj!(W8UVGcWI)7rj~h?cY=$7q++0% zM|iHbcvK=|ZltAx+m=TjS(YNLrscXc?H{ne?96-bGjHb2JLbL5%m0~xIj|4B4+H`o z0I+DH3{z!#e(xTc&FvKq%0P}p#5jXmgnG*|M={dL-3bJ0Emi#zq9pTG60p7`5J>IO zSCtdQ-w6kSlv)6^lUGX6`$~I)q5HwSkwdMXHZZ8gC&fNcWTwImi0!6QcP30YZ~z~H zOHjl*b)gkC9D>&x&Mc4{@24HCTCTc_iAkRDw>~k zcYLFIR5@GD73k}4+&26h#mD`fKdyTySLejmuM2KI8bQo?n|Vk^MPSilU(;PX3o(lG>K(HZu`h+AFqFy)RI3DATyHPG^k$0;S9;}yan z7*1Z+AudY-Zc?Be(Jr(P%C?1^<2<_?4wS&nC!~S$Ng9JZ4+#sU7~y zRyDXiz5{8Ssjg+f>tY0)FiAhplrUGVEyV(X^^dygcR~cp2L6v`cY{k)rjt;d=g&RC z#jYJwaZ#OqV>>(c9&?7Mu1~$J#Wc`o;xV_xgLG-xDLOvNrgBUokxaKMkjZ4L>Zi+F zTU!QK(=#$McBmfnpDibe!H{M*+Qv8~=QLc)&-hSMLIPKcV%FCip&T6QMIsSfEUwkZ zeppFMRGTf7qd$r8cz{M@Fqov|`ktpdXMTaGOd(edkaM6AFcIo>n`| z`O@Ct6Oo87^Yh`6RiSqJS}LKftCoD6tLtqIR}V(eH0CaqHx*}A(Dw3zxdlc-**e{W zMmJ8xMC!kmN~x3YtjpFs%{DUXEQedK6@{j5tgShYEF?zOT_llyijR-~RzQss2dUjk zCzO_!>aKDFkjvZK+wlg%hf?Qi#st2R(s^x2X$H^e=kZ4Qe5IGKUd?enN+eE&{4AuY zDfz>~OzbQ#zGM5aX^^xZoO^#60zui?u_Y<^+hfzRjU}cl)yEm6QEK* zYQLNc`9d9Q*qQ!p z|2HPVUEJ{Cf{8^i06)jB3Vc9q z#lK6b=V~a7blI~T)^qhZ)X<&nUtZvKY%1C{au+I!R lenis.resize()); ScrollTrigger.refresh(); + initSmoothCursor(); + let lastScrollTop = 0; const nav = document.querySelector('nav'); @@ -411,3 +413,60 @@ function initStars() { section.appendChild(starContainer); }); } + +function initSmoothCursor() { + if (window.innerWidth <= 768) return; + + const cursor = document.createElement('div'); + cursor.className = 'dot-cursor'; + document.body.appendChild(cursor); + + let mouseX = 0; + let mouseY = 0; + let cursorX = 0; + let cursorY = 0; + let velocityX = 0; + let velocityY = 0; + + const ease = 0.15; + const friction = 0.85; + + document.addEventListener('mousemove', (e) => { + mouseX = e.clientX; + mouseY = e.clientY; + }); + + const interactiveElements = 'a, button, [role="button"], input, textarea, select, .card, .card-sponsors'; + + document.addEventListener('mouseover', (e) => { + if (e.target.closest(interactiveElements)) { + cursor.classList.add('hover'); + } + }); + + document.addEventListener('mouseout', (e) => { + if (e.target.closest(interactiveElements)) { + cursor.classList.remove('hover'); + } + }); + + function updateCursor() { + const dx = mouseX - cursorX; + const dy = mouseY - cursorY; + + velocityX += dx * ease; + velocityY += dy * ease; + + velocityX *= friction; + velocityY *= friction; + + cursorX += velocityX; + cursorY += velocityY; + + cursor.style.transform = `translate(${cursorX - 4}px, ${cursorY - 4}px)`; + + requestAnimationFrame(updateCursor); + } + + updateCursor(); +}