diff options
| -rw-r--r-- | front/src/components/animated_bg.tsx | 14 |
1 files changed, 13 insertions, 1 deletions
diff --git a/front/src/components/animated_bg.tsx b/front/src/components/animated_bg.tsx index 6a8ab3a..80a8a63 100644 --- a/front/src/components/animated_bg.tsx +++ b/front/src/components/animated_bg.tsx @@ -111,4 +111,16 @@ const timeLoop = ( }; } -export const AnimatedBg = timeLoop(AnimatedBgInternal, { refreshRate: fps }); +const checkWebGL = () => { + try { + const canvas = document.createElement("canvas"); + return !!( + window.WebGLRenderingContext && + (canvas.getContext("webgl") || canvas.getContext("experimental-webgl")) + ); + } catch (e) { + return false; + } +} + +export const AnimatedBg = checkWebGL() ? timeLoop(AnimatedBgInternal, { refreshRate: fps }) : () => <div />; |
