Jordon Baade •

The Lightweight Wins — Visual Effects That Cost Almost Nothing

The best visual effects are the ones your visitors notice but Lighthouse does not. That is not a zen koan. It is a design principle we actually build around.

In Part 1 of this series, we laid out the performance spectrum — the idea that every visual effect sits somewhere on a cost curve from free to expensive, and that most sites reach for the expensive end way too early. This post is about the free and cheap tiers. The effects that make your site feel polished and alive without adding a single millisecond to your Total Blocking Time.

We built working examples of every technique in this post. They are not hypothetical. You can see them, interact with them, and check their Lighthouse scores yourself.

CSS-only effects: literally free

CSS animations are the closest thing to a free lunch in web development. When you animate transforms and opacity, the browser hands that work to the compositor thread — a separate process from the main thread where your JavaScript runs. There is no JS to parse, no bundle to download, no network request to wait for. The browser just does it.

What can you actually build with just CSS? More than most people think. Morphing blob shapes. Glassmorphism cards with frosted-glass blur. 3D card flips on hover. Animated gradient borders that pulse and shift. Glitch text effects. Living gradient backgrounds that slowly cycle through colors. We built all of these, and every single one scores the same on Lighthouse: 0ms TBT, 0 bytes of JavaScript, zero impact.

The only rule is to avoid animating layout properties — width, height, margin, padding. Those trigger layout recalculations and can cause Cumulative Layout Shift, which Lighthouse will absolutely punish you for. Stick to transforms and opacity and you are golden.

The catch? CSS keyframes and transitions can only express so much. You cannot react to scroll position. You cannot track the mouse cursor. You cannot coordinate timing across elements based on user behavior. When you need any of that, you step up a tier. But you should exhaust what CSS gives you before you reach for anything else.

Canvas 2D particles: one script, zero libraries

You know that effect where a hero section has a subtle particle network floating in the background — dots drifting slowly, lines connecting nearby particles, the whole thing responding gently to your mouse? That looks like it would require a hefty library. It does not.

One <canvas> element and a vanilla JavaScript file. No libraries, no dependencies, no npm install. We built a full particle system with 200 particles, proximity-based connections, mouse attraction, and click scatter — and the entire script is roughly 3KB.

Why is it so cheap? The math is simple arithmetic. Each frame, you update each particle's x and y position by a velocity value, check if it hit an edge, and calculate distances to nearby particles to draw connection lines. That is addition, subtraction, and a distance formula. requestAnimationFrame runs the loop at screen refresh rate, and the browser optimizes canvas drawing heavily because it has been doing it for over a decade.

Typical cost: negligible TBT because the script evaluates in under a millisecond. No additional network requests. The rAF loop uses about 1-2ms per frame, which leaves you with 14-15ms of headroom on a 60fps budget. This is the kind of effect that works beautifully as a hero background, an ambient texture behind content sections, or a transition state between page loads.

Alpine.js parallax and scroll reveals: almost nothing on top of what you already have

If your site already loads Alpine.js — and ours do — then adding scroll-triggered reveals and parallax effects costs almost nothing incremental. The Alpine intersect plugin weighs about 6KB. That is the entire additional cost.

Here is why it is so efficient. IntersectionObserver is a native browser API. It does not poll scroll position on every frame. It does not attach a scroll event listener that fires sixty times a second. Instead, it registers thresholds with the browser and gets a callback only when an element crosses one of those thresholds. The browser handles the observation internally, at the compositor level, with near-zero overhead.

CSS transitions handle the actual visual animation. Alpine just flips a boolean — x-show goes from false to true, a class gets toggled, and the browser's transition engine takes over with transforms and opacity changes that run on the compositor thread. Alpine is not animating anything. It is just the trigger.

For parallax layers, we use a single requestAnimationFrame handler gated by visibility. When the section is not in the viewport, the handler does nothing — it checks an IntersectionObserver flag and returns immediately. When it is visible, it reads scrollY and applies a transform. One scroll read, one style write, no layout thrashing. You can see this in action on our parallax storytelling showcase.

Total cost: about 6KB for the intersect plugin if you did not already have it. Everything else is CSS transitions that the browser was going to run anyway. Lighthouse does not even notice.

SVG and Alpine: the city skyline

This one is our favorite because it looks like it should be expensive. A full city skyline with a day-to-night transition, six parallax depth layers, building windows that light up as dusk falls, a sun that sets and a moon that rises. It looks like a complex illustration that would require heavy raster images or a WebGL scene.

It is SVG rectangles with Alpine-driven fill colors. That is it.

Every building is an SVG rect. Every window is a smaller rect inside it. The sky is a gradient that Alpine interpolates from daytime blues to nighttime darks as you scroll. The sun and moon are circles that Alpine repositions along an arc. Zero raster images are loaded. The entire scene is resolution-independent vector markup that looks sharp on a 4K display and weighs almost nothing over the wire.

SVG renders on the GPU. Alpine interpolates a handful of color values in a scroll handler — basic math on RGB channels. The visual complexity is high but the computational complexity is trivially low. This is the most visually impressive effect in our lightweight tier, and it still barely registers on a Lighthouse audit.

The rule of thumb

Here is the decision framework we use on every project. If you can do it with CSS, do it with CSS. Pure CSS animations are free and you should treat them that way — use them liberally for hover states, loading indicators, ambient motion, and decorative flourishes.

If you need scroll awareness — elements revealing as they enter the viewport, sections that respond to scroll position — add Alpine's intersect plugin and let CSS transitions do the heavy lifting. You are adding 6KB to get native browser observation with no polling overhead.

If you need continuous, interactive animation — particles, generative patterns, physics-based motion — use vanilla Canvas 2D. One script file, no dependencies, requestAnimationFrame, simple math. You will be surprised how much you can do in 3-5KB of plain JavaScript.

Do not reach for a library until you have exhausted what the browser gives you for free. The platform is remarkably capable if you let it do its job instead of abstracting it away behind ten layers of framework code.

But sometimes you do need the heavy tools. Sometimes the effect you want genuinely requires WebGL, a 3D scene graph, real-time lighting, or GPU-computed particle physics. In Part 3, we will talk about Three.js, WebGL, and what happens to your performance metrics when you step into that tier — and why it is sometimes still worth it.