The Illusion of Zero Dependencies: Unpacking liquid-effect-animation
How a Next.js component uses runtime script injection and hidden 2D canvases to deliver high-end WebGL shaders without touching your package.json.

nothing just an experimental component
- The project achieves a "zero-dependency" WebGL effect by injecting Three.js via a runtime CDN script, bypassing the NPM bundler entirely.
- To save performance, it fakes 3D typography by painting 2D text onto a hidden HTML5 canvas, applying a simulated lighting gradient, and exporting it as a flat WebGL texture.
- The component relies on Tailwind v4 and the OKLCH color space to ensure perceptually uniform color transitions, critical for selling the physical illusion of liquid metal.
- Distributed via the shadcn registry model, it reflects a shift from installing black-box NPM libraries to owning and modifying the rendering pipeline.
The Smuggler's Architecture
Most high-end WebGL UI effects require heavy 3D libraries that bloat your bundle size. liquid-effect-animation claims zero dependencies. It achieves this through a massive cheat: it injects the Three.js engine via a runtime CDN script. This bypasses the build-time bundler entirely.
useEffect(() => {
const script = document.createElement('script');
script.type = 'module';
script.src = 'https://cdn.jsdelivr.net/npm/threejs-components@0.0.17/build/liquid1.min.js';
document.body.appendChild(script);
// ...
}, []);
This is a bold choice for a React component, moving the dependency from build-time (npm install) to run-time (browser fetch).
Faking 3D with a Hidden Canvas
Rendering true 3D text is computationally heavy. The component instead paints 2D text onto an offscreen canvas, applies a radial gradient to simulate ambient light, and exports it as a Base64 image to be used as a texture on a flat WebGL plane.
This pipeline allows for easy text customization while maintaining the performance of a WebGL fragment shader.
The Chrome Aesthetic and OKLCH
The styling choices rely on Tailwind v4 and the OKLCH color space to ensure perceptually uniform color transitions. This is critical for selling the physical illusion of liquid metal.
The End of the Black-Box Library
The shadcn registry model shifts power to the developer by letting them own and modify the complex pipeline rather than just passing props to a compiled NPM package.
Instead of installing a black-box package, developers own the source code, allowing for deep customization.