Vue Wrapper For Motion One Animation Library

Description:

A Vue 3 wrapper for Motion One, which is an animation library for building fast, performance animations.

How to use it:

1. Import and register the MotionOne plugin.

import { createApp } from 'vue'
import { MotionOnePlugin } from 'vue-motion-one'
import App from './App.vue'
const app = createApp(App)
app.use(MotionOnePlugin)
app.mount('#app')

2. Animated an element using the v-animate directive.

<template>
  <div
    v-animate
    // Motion One Keyframes
    :keyframes="{
      transform: 'rotate(90deg)'
    }"
    // Motion One Animation Options
    :options="{
      duration: 0.75
    }"
  />
</template>

3. Animate an element or multiple elements using the useAnimate hook.

import { ref, onMounted } from 'vue'
import { useAnimate } from 'vue-motion-one'
const boxRef = ref()
const { play } = useAnimate(
  boxRef,
  { transform: 'rotate(45deg)' },
  { duration: 0.5 }
)
onMounted(() => {
  play()
})
<template>
  <div class="box" ref="boxRef"></div>
</template>

4. Create complex sequences of animations using the useTimeline hook.

import { ref, onMounted } from 'vue'
import { useTimeline } from 'vue-motion-one'
const boxRef = ref()
const { play } = useTimeline(
  [
    ['.box', { x: 100 }],
    [boxRef, { x: 100 }]
  ],
  { duration: 1 }
)
onMounted(() => {
  play()
})
<template>
  <div class="box"></div>
  <div ref="boxRef"></div>
</template>

Preview:

Vue Wrapper For Motion One Animation Library

Changelog:

v0.1.5 (10/13/2021)

  • Update

Download Details:

Author: wobsoriano

Live Demo: https://vue-motion-one.vercel.app/#/examples/animating-list

Download Link: https://github.com/wobsoriano/vue-motion-one/archive/refs/heads/master.zip

Official Website: https://github.com/wobsoriano/vue-motion-one

Install & Download:

# Yarn
$ yarn add vue-motion-one motion

# NPM
$ npm i vue-motion-one motion

You Might Be Interested In:

Add Comment