1.0.2 • Published 3 years ago

@dcasia/vue-aos v1.0.2

Weekly downloads
-
License
ISC
Repository
github
Last release
3 years ago

Vue AOS

Implementing animation on scroll based on Vue 3

How to use

  1. Install it from NPM
npm i @dcasia/vue-aos --save
  1. Import and register it in your Vue entry file
// main.ts

import { createApp } from 'vue'
import App from './App.vue'
import VueAOS from '@dcasia/vue-aos'
import '@dcasia/vue-aos/dist/vue-aos.css'

createApp(App)
    .use(VueAOS, {
        disable: false,
        isBrowser: true,
        anchorPlacement: 'center-bottom',
        once: true,
        duration: 1000,
        easing: 'ease-out',
        offset: 0,
        startEvent: 'init-aos',
        disableMutationObserver: false
    })
    .mount('#app')
  1. Feel free to use it in your Vue template
// app.vue

<AOS>
    <div>
        I'll be animated when you see me in the viewport
    </div>
</AOS>

Options

Global Options

NameTypeFunctionality
disableBooleanWhether to disable the effect globally
isBrowserBooleanWhether the current environment is a browser environment
anchorPlacement….
onceBooleanWhether only have elements fade in and without fading out
durationNumberAnimation duration
easingAnimation easing type
offsetNumberDistance from the trigger point, can be negative
startEventStringName of the event dispatched on the document, that AOS should initialize on
disableMutationObserverBooleanDisables automatic mutations' detections

Component Options

Options for single instance

NameTypeFunctionality
typeStringAnimation type
easingStringAnimation easing type
durationNumber | StringAnimation duration
offsetNumber | StringDistance from the trigger point, can be negative
delayNumber | StringAnimation delay
anchorStringThe name of the specified trigger anchor point
anchorPlacementThe position of the trigger point, taken from several key positions of the element and viewport
orderNumber | StringThe sequential animation order, it basically automatically calculate delay for current instance
stepNumber | StringThe Interval delay between different order
isGroupBooleanWhether to create a container element
tagStringThe tag name of the container
disableAnimationBooleanDisable animation on current instance but still can be triggered and emit key events
onceBooleanWhether only have elements fade in and without fading out
persistentAttributesBooleanWhether to retain aos custom attributes and class names after animation is done
hiddenOnServerBooleanWhether to hide itself on server side rendering to make it hidden at the very first beginning when it’s showing on client side

API

...