Configuration

Some animation effects can be modified by configuration

Global Configuration

By adding global configuration when registering the plugin

propertyexplanationtypedefult value
delaydelay?number0
durationanimation duration?number1000
repeatrepeat times?number|"infinite"1
prefixclass name prefix,custom build Animate.css prefix?stringanimate__
stopdisable animation?booleanfalse
const app = createApp(App);
app.use(
  vueAnimateCss(
    GlobalAnimateConfig.init({
      delay: 5000,
      duration: 15000,
      repeat: 2
      // repeat: "infinite"
    })
  )
app.mount("#app");

Partial Configuration

You can also configure the configuration after each directives.

propertyexplanationtypedefult value
delaydelay?numberinherited from global
durationanimation duration?numberinherited from global
repeatrepeat times?number|"infinite"inherited from global
autoPlayWhether to play automatically
by default it will play immediately after the element is created
?booleantrue
<div v-bounce="state.bounceConfig">bounce</div>
import { reactive } from "vue";
import { AnimateConfig } from "animation-vue";

const state = reactive<{
  bounceConfig: AnimateConfig;
}>({
  bounceConfig: {
    duration: 2000,
    repeat: 3,
    delay: 700,
    // autoPlay Mostly used for functional control animation play
    autoPlay: false
  }
});

Modifiers

Through the modifiers, you can avoid manually setting js/ts for corresponding event monitoring

propertyexplanation
clickclick event
hoverdesktop mouseenter event
<div v-bounce.click="state.bounceConfig">bounce</div>
import { reactive } from "vue";
import { AnimateConfig } from "animation-vue";

const state = reactive<{
  bounceConfig: AnimateConfig;
}>({
  bounceConfig: {
    duration: 2000,
    autoPlay: false
  }
});

warning

When the modifiers is used, if autoPlay is false, the animation will not play by default until autoPlay is true.
The animation will not end when repeat is set to infinite, and will only play when autoPlay is true.

Last Updated:
Contributors: yzj