perf: optimized gradientblinds
This commit is contained in:
@@ -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);
|
||||
|
||||
Reference in New Issue
Block a user