From aa8fb73c618c9a8eaa1c8a3d22b3314c7d235a89 Mon Sep 17 00:00:00 2001 From: code002lover Date: Mon, 8 Dec 2025 19:50:19 +0100 Subject: [PATCH] fix bug + 30fps lock --- frontend/src/ShaderBackground.tsx | 15 +++++++++++++++ 1 file changed, 15 insertions(+) diff --git a/frontend/src/ShaderBackground.tsx b/frontend/src/ShaderBackground.tsx index ece2667..7c80954 100644 --- a/frontend/src/ShaderBackground.tsx +++ b/frontend/src/ShaderBackground.tsx @@ -226,9 +226,24 @@ export const ShaderBackground: React.FC = ({ gl!.bindTexture(gl!.TEXTURE_2D, ichannel1_texture); gl!.uniform1i(final_iChannel1, 1); + let last_update: number = 0; + + const compiled_theme = theme; + function update(now: number) { // time in seconds const time = now / 1000; + + if (compiled_theme !== theme) { + return; + } + + if (time - last_update < (1 / 30)) { + requestAnimationFrame(update); + return; + }; + last_update = time; + gl!.clear(gl!.COLOR_BUFFER_BIT); setTime(finalProgram!, time);