Liquid/Blob Effects: SVG, CSS, WebGL Implementation
On a project for a fintech platform, the client wanted an animated background with living drops. The first version using CSS blur+contrast led to LCP 4.2s and constant reflow on iOS. We rewrote it in WebGL—LCP dropped to 1.8s, FPS rose from 25 to 60. This situation is typical: trendy effects can easily ruin performance. Over five years we have implemented more than 50 animated solutions with Core Web Vitals optimization. Let's break down three working approaches: SVG morphing, CSS blur+contrast, and WebGL metaballs. We'll show how to avoid pitfalls.
Typical problems and solutions
JavaScript-based animation causes reflow, intense repaint, degradation on low-FPS mobile devices. Particularly dangerous is the CSS blur+contrast trick—it forces the browser to composite every frame, killing FPS on older iPhones. Comparison: WebGL solutions show three times higher FPS on mobile compared to CSS equivalents at the same visual complexity. Choosing the right method is key to success.
How we solve these problems
We use WebGL for complex morphings at 60 FPS even on mid-range devices. For simple backgrounds, SVG with GSAP MorphSVG. Example: on a fintech platform project, we replaced a CSS blob with WebGL—LCP dropped from 3.2s to 1.8s, server resource savings up to 40% due to reduced CPU load.
SVG Blob with animated path
Basic variant: SVG shape with animation of control points via JS. Simpler to use GSAP MorphSVGPlugin:
import gsap from 'gsap' import MorphSVGPlugin from 'gsap/MorphSVGPlugin' gsap.registerPlugin(MorphSVGPlugin) // Morphing between paths gsap.to('#blob-path', { morphSVG: '#blob-path-b', duration: 3, ease: 'sine.inOut', repeat: -1, yoyo: true, }) CSS Blob via filter: blur + contrast
Cheap but effective trick. Several circles with blur, wrapped in a container with contrast(20). At the blur boundaries of overlapping circles, a liquid merging effect appears. This method is easy to implement but requires caution with will-change and element count.
<div class="blob-container"> <div class="blob blob--1"></div> <div class="blob blob--2"></div> <div class="blob blob--3"></div> <div class="blob blob--cursor"></div> </div> .blob-container { position: fixed; inset: 0; filter: blur(40px) contrast(20); /* contrast() — key to the effect */ } .blob { position: absolute; border-radius: 50%; background: #7000ff; } .blob--1 { width: 300px; height: 300px; top: 20%; left: 30%; animation: blob-float-1 8s ease-in-out infinite alternate; } @keyframes blob-float-1 { 0% { transform: translate(0, 0) scale(1); } 50% { transform: translate(80px, -60px) scale(1.1); } 100% { transform: translate(-40px, 40px) scale(0.9); } } The blob-cursor follows the mouse via JS with smooth interpolation.
WebGL Liquid via shader
Full control over shape, color, behavior—through GLSL. Shader based on signed distance function (SDF):
// Fragment shader — liquid metaballs uniform float uTime; uniform vec2 uMouse; uniform vec2 uResolution; float circle(vec2 p, vec2 center, float r) { return length(p - center) - r; } float smoothUnion(float d1, float d2, float k) { float h = clamp(0.5 + 0.5 * (d2 - d1) / k, 0.0, 1.0); return mix(d2, d1, h) - k * h * (1.0 - h); } void main() { vec2 uv = (gl_FragCoord.xy - uResolution * 0.5) / min(uResolution.x, uResolution.y); vec2 mouse = (uMouse - uResolution * 0.5) / min(uResolution.x, uResolution.y); vec2 p1 = vec2(sin(uTime * 0.7) * 0.3, cos(uTime * 0.5) * 0.2); vec2 p2 = vec2(cos(uTime * 0.4) * 0.25, sin(uTime * 0.8) * 0.25); vec2 p3 = mouse * 0.5; float d1 = circle(uv, p1, 0.18); float d2 = circle(uv, p2, 0.14); float d3 = circle(uv, p3, 0.12); float merged = smoothUnion(smoothUnion(d1, d2, 0.08), d3, 0.06); vec3 colorInner = vec3(0.4, 0.0, 1.0); vec3 colorRim = vec3(0.0, 0.8, 1.0); float fill = smoothstep(0.005, -0.005, merged); float rim = smoothstep(0.02, 0.0, merged) - smoothstep(0.0, -0.02, merged); vec3 color = mix(vec3(0.0), colorInner, fill); color += colorRim * rim * 0.8; gl_FragColor = vec4(color, fill + rim * 0.5); } Why WebGL is preferable for complex animations?
WebGL performs all calculations on the GPU, offloading the CPU. This is especially important for animations with many interactive elements. In our projects, WebGL solutions show two times lower TTFB compared to CSS equivalents at the same visual complexity. WebGL is supported by all modern browsers, with a fallback for older ones.
Which method to choose for your project?
| Complexity | Recommended method | Approx. development time | Impact on LCP |
|---|---|---|---|
| Low (simple background) | SVG+GSAP | 1–2 days | Minimal |
| Medium (multiple blobs with interactivity) | CSS blur+contrast | 2–3 days | Medium (needs optimization) |
| High (complex morphing, mouse response) | WebGL | 5–7 days | Low (with proper lazy loading) |
Graceful degradation for old browsers
To ensure operability in IE11 and older Safari versions, we use Modernizr to check WebGL and CSS filter support. If WebGL is unavailable, a static SVG image is loaded. For the CSS trick, we add a fallback gradient background. We always test on real devices.Process of work
- Analytics — study design requirements, Core Web Vitals, supported browsers.
- Design — choose method: SVG/CSS/WebGL, create performance prototype.
- Implementation — write code, test on real devices.
- Testing — check FPS, LCP, CLS on mobile and desktop.
- Deployment — integrate into project, configure fallback for old browsers.
Timeline: from 1 day (CSS blob) to 7 days (WebGL metaballs). The cost is calculated individually per task. Get a consultation for your project—we will prepare a proposal considering your metrics.
What is included in the work
| Deliverable | Description |
|---|---|
| Source code | Complete effect code (JS/TS/CSS/GLSL) |
| Documentation | Integration, configuration, customization instructions |
| Test report | Performance and Core Web Vitals results |
| Support | 2 weeks free support after deployment |
Checklist: typical mistakes and solutions
| Mistake | Solution |
|---|---|
| Animation causes reflow | Use transform and opacity for animation |
| Too many blur elements | Optimize number of circles (max 5) |
| No fallback for old browsers | Add @supports or Modernizr |
| FPS below 30 | Switch to WebGL or simplify animation |
We guarantee that every effect passes Core Web Vitals audit. We will evaluate your project for free—contact us via email or messengers. Our certified specialists with 5+ years of experience will prepare a solution that won't drop performance.







