perf: optimized gradientblinds

This commit is contained in:
Melvin Ragusa
2026-01-24 11:33:46 +01:00
parent e6df2d25be
commit 6b17b8b007
2 changed files with 55 additions and 12 deletions

View File

@@ -330,7 +330,6 @@ void main() {
uniforms.iMouse.value = [x, y];
}
};
window.addEventListener('pointermove', onPointerMove);
const loop = (t: number) => {
rafRef.current = requestAnimationFrame(loop);
@@ -364,11 +363,13 @@ void main() {
lastTimeRef.current = 0;
rafRef.current = requestAnimationFrame(loop);
}
window.addEventListener('pointermove', onPointerMove);
} else {
if (rafRef.current) {
cancelAnimationFrame(rafRef.current);
rafRef.current = null;
}
window.removeEventListener('pointermove', onPointerMove);
}
});
observer.observe(container);