Animated
Animated: plain HTML
One script tag. No bundler, no build step.
Install
- Open an Animated cursor in the gallery, choose your options and Download zip.
- Copy the zip’s
cursor/folder into your public folder so it’s served at/cursor/. Keep the folder as it is; the files import each other by relative path. - Add one tag to every page:
<script type="module" src="/cursor/auto.js" data-cursor-library
data-family="dot-ring" data-variant="dark" data-scope="#hero"></script>
Module scripts are deferred by default. The zip also has an example.html; serve the extracted folder over HTTP (for example python3 -m http.server) to try it, since module imports may be blocked when opened via file://.
Options
| Attribute | Values | Default |
|---|---|---|
data-family |
morph, dot-ring, elastic, squish, blob, spotlight, arrow-chip, brand |
morph |
data-variant |
light, dark, accent |
light |
data-accent |
a hex colour | #2F6BFF |
data-scope |
a CSS selector | the whole page |
data-mode |
replace (draw the cursor instead of the native one) or enhance (draw it alongside) |
replace |
data-brand-src |
image URL (brand family only) | — |
data-brand-hotspot |
x,y in pixels |
0,0 |
data-brand-size |
8–64 | 32 |
data-brand-hover-src |
image URL for hover | — |
What loads, and when
auto.js and its loader are fetched first. The script applies a remembered “Use default cursor” choice, then loads the runtime and selected family only when the primary pointer can hover and is fine, and neither forced colours nor increased contrast is active. See Performance.
Controlling it
The script fires a cursor-library:ready event on document with the cursor handle (or null when unavailable or loading fails). Register the listener before the module can dispatch it:
document.addEventListener('cursor-library:ready', (e) => {
const cursor = e.detail;
cursor?.disable(); // and cursor?.enable(), cursor?.destroy()
});
To turn it off for a visitor, set data-cursor="native" on <html> (see the toggle).