Skip to content

Commit 8688e4b

Browse files
author
Manuel
committed
perf: throttle scroll listener + reduce aurora blur for smoother scrolling
1 parent 84dacbe commit 8688e4b

3 files changed

Lines changed: 22 additions & 14 deletions

File tree

website/index.html

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -182,7 +182,7 @@ <h1>REVERSO Protocol — Reversible Blockchain Transactions</h1>
182182
</div>
183183

184184
<div class="nav-actions">
185-
<a href="#" class="btn btn-ghost" id="connectWallet">
185+
<a href="javascript:void(0)" class="btn btn-ghost" id="connectWallet">
186186
<span class="wallet-dot"></span>
187187
Connect Wallet
188188
</a>

website/src/main.js

Lines changed: 17 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -1659,18 +1659,25 @@ function initTransferCardAnimation() {
16591659
// Nav Scroll Effect
16601660
// ==========================================
16611661
let lastScroll = 0;
1662+
let scrollTicking = false;
16621663
window.addEventListener('scroll', () => {
1663-
const nav = document.querySelector('.nav');
1664-
const currentScroll = window.pageYOffset;
1665-
1666-
if (currentScroll > 100) {
1667-
nav.style.background = 'rgba(10, 10, 15, 0.95)';
1668-
} else {
1669-
nav.style.background = 'rgba(10, 10, 15, 0.8)';
1664+
if (!scrollTicking) {
1665+
requestAnimationFrame(() => {
1666+
const nav = document.querySelector('.nav');
1667+
const currentScroll = window.pageYOffset;
1668+
1669+
if (currentScroll > 100) {
1670+
nav.style.background = 'rgba(10, 10, 15, 0.95)';
1671+
} else {
1672+
nav.style.background = 'rgba(10, 10, 15, 0.8)';
1673+
}
1674+
1675+
lastScroll = currentScroll;
1676+
scrollTicking = false;
1677+
});
1678+
scrollTicking = true;
16701679
}
1671-
1672-
lastScroll = currentScroll;
1673-
});
1680+
}, { passive: true });
16741681

16751682
// ==========================================
16761683
// Layer Hover Effects

website/src/styles/main.css

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -177,13 +177,14 @@ body::after {
177177
.aurora-orb {
178178
position: absolute;
179179
border-radius: 50%;
180-
filter: blur(100px);
181-
opacity: 0.6;
180+
filter: blur(60px);
181+
opacity: 0.5;
182182
z-index: -1;
183183
pointer-events: none;
184184
will-change: transform;
185-
contain: layout style;
185+
contain: layout style paint;
186186
backface-visibility: hidden;
187+
transform: translateZ(0);
187188
}
188189

189190
.aurora-orb-1 {

0 commit comments

Comments
 (0)