Back to Blog

Vanta.js in WordPress: Add It by Hand or Use an Animated Background Plugin?

How to add a Vanta.js background to WordPress with code, what you then have to handle yourself — mobile, reduced motion, caching, CDN requests — and when a plugin like Animation Kit is the simpler route.

You can add Vanta.js to WordPress with a few lines of code: load three.js and an effect script, then start the effect on an element. It works, but you take on the rest — a fallback for phones, respecting reduced motion, keeping caching plugins from breaking it, and loading scripts from a CDN. If you'd rather pick an effect, set colours and switch it on, a plugin like Animation Kit does those parts for you.

Disclosure: WPXERO makes Animation Kit; this covers Animation Kit 0.5.0. Facts about Vanta.js come from vantajs.com, its GitHub repository and npm as of October 27, 2026.

What Vanta.js is

Vanta.js is an open-source (MIT) library of animated 3D backgrounds — Waves, Birds, Fog, Clouds, Trunk, Topology and more — built on three.js or p5.js. You attach an effect to an element and set options such as colour, speed and zoom. It's popular because the effects look great and the library is free.

Things to know before you build on it:

  • Its latest npm release, 0.5.24, dates from September 2022, and its examples use three.js r134.
  • Its site says some effects are slow on older computers, advises using one or two effects per page, and notes that not all effects work on mobile, so you should set a fallback background.

Adding Vanta.js to WordPress by hand

  1. Give the section you want animated an anchor or class — for example, select a Group block and set Advanced → HTML anchor to hero-bg.
  2. Add the scripts to your footer with a code-snippet tool (such as ExtenderX's free Insert Headers & Footers) or your child theme:
<script src="https://cdnjs.cloudflare.com/ajax/libs/three.js/r134/three.min.js"></script>
<script src="https://cdn.jsdelivr.net/npm/vanta@0.5.24/dist/vanta.waves.min.js"></script>
<script>
  if (!window.matchMedia('(prefers-reduced-motion: reduce)').matches) {
    VANTA.WAVES({
      el: '#hero-bg',
      color: 0x1e293b,
      waveSpeed: 0.6,
      zoom: 0.8
    });
  }
</script>
  1. Give the Group block a background colour or image, so visitors without the effect still see something.
  2. Clear your cache and test on desktop and a phone.

That's the minimum. The prefers-reduced-motion check above isn't part of Vanta; you need to add it yourself.

What you're now responsible for

ConcernBy hand with Vanta.jsAnimation Kit
PhonesWrite your own check and fallbackOn phones setting: full, lighter, still image or nothing
Reduced motionAdd your own checkStill image automatically; no WebGL code downloaded
Save-Data and no-WebGLYour own checksStill image automatically
Off-screen and hidden tabsYour own codePauses automatically
Caching plugins (delay JS, combine, minify)Exclude the scripts yourselfCompatibility rules for WP Rocket, LiteSpeed Cache, Autoptimize, W3 Total Cache, WP Fastest Cache
Script loadingTwo CDN requests on every page you add it toServed from your site, only where a background is on; each effect lazy-loaded
PrivacyVisitor IPs reach the CDNsNo external requests for the effect
Text readabilityStyle an overlay yourselfReadability overlay setting
Clicks through the backgroundMake sure the canvas doesn't block themLayer is aria-hidden and pointer-events: none
Changing coloursEdit codeColour pickers and live preview
Different effect per pageMore codePro: per-page targeting

None of this is hard for a developer. It's the ongoing maintenance — theme changes, cache plugin updates, a client asking for "the blue one" — that adds up.

Animation Kit as the no-code route

Animation Kit draws a WebGL background from a settings screen:

  1. Install it and open Animation Kit → Background Animation.
  2. Pick one of the 6 free effects — Aurora, Antigravity, Particles, Silk, Light Pillar or Radar — or start from a ready-made look, including looks made for white sites.
  3. Set your colours, check the live preview on your theme's real colours, and switch it on.

For one section, select a Group or Cover block and turn on Animated background in its settings.

Its effects are its own designs rather than copies of Vanta's, so compare them on the effects demo. Animation Kit Pro adds 17 more (23 in total) — including Line Waves, Floating Lines, Plasma, Starfield and Soft Aurora — plus speed, density, scale and pointer-response controls, layered backgrounds with blend modes, per-page targeting and CSS-selector targeting for page builders.

Which should you choose?

If you…Choose
Need one specific Vanta effect (such as Birds) and can maintain codeVanta.js by hand
Are building a custom theme or app and want full controlVanta.js (or three.js directly)
Want an animated background without codeAnimation Kit
Need phone, reduced-motion and caching handled for youAnimation Kit
Want to change effects and colours without a developerAnimation Kit

To compare plugins rather than libraries, see the animated background plugin comparison.

Common Questions

Yes. Load three.js and the Vanta effect script, then call the effect on an element, for example with a code snippet plugin or your theme's footer. You then need to handle mobile fallbacks, reduced motion and caching yourself.

Vanta.js is open source under the MIT license. Its latest npm release, 0.5.24, was published in September 2022, and it loads three.js r134 in its own examples.

Animation Kit adds WebGL animated backgrounds from a settings screen — 6 effects free and 23 with Pro — behind the whole site or one Group or Cover block, with a still image for reduced motion and a phone setting.

Vanta's own site notes that not all effects work on mobile and recommends a background image or colour as a fallback. Some effects can also be slow on older computers.

Get new guides and releases by email

Occasional emails when we publish a guide or ship a notable plugin update. No spam — unsubscribe any time.

We only use your email to send these updates. See our privacy policy.