Triggers

data-viv-on decides when a composition fires. This is Vivace's core upgrade over CSS-only animation libraries: one engine, shared observers, no per-element listeners.

TriggerFiresImplementation
load (default)as soon as the element is registeredimmediate; MutationObserver registers SPA-mounted elements
appearingwhen the element enters the viewportone shared IntersectionObserver for the whole page
hoveron pointer entersingle capture listener on the document
clickon click / tapevent delegation
focuswhen the element receives focusfocusin delegation — great for form fields

Try them

hover me
scrolled in

Replay on every scroll

appearing fires once by default. Add data-viv-repeat-scroll and the element re-arms whenever it leaves the viewport:

html
<div data-viv="@sl-y" data-viv-on="appearing" data-viv-repeat-scroll>

Programmatic control

ts
import Vivace from 'vivace-css'

Vivace.trigger(el)  // fire or restart, regardless of trigger type
Vivace.pause(el)    // freeze mid-animation
Vivace.play(el)     // unpause — or fire if it never ran
Vivace.destroy()    // remove all listeners and observers

Accessibility

Under prefers-reduced-motion: reduce, every animation collapses to an instant snap: entrances appear immediately, exits still hide. No content is ever lost behind a paused entrance animation.

Portrait of Axel RAKOTOARIVAO
Created by
Axel RAKOTOARIVAO
MIT — keyframe DSL inspired by A.css
bun add vivace-css