Motion Plus Vue Components

1.8.1 · active · verified Sun Apr 19

Motion Plus Vue (current stable version 1.8.1) is a Vue 3 component library that extends the capabilities of the core `motion-v` animation engine. It primarily focuses on providing specialized, high-performance animation components, such as `AnimateNumber`, for modern Vue applications. While `motion-v` (version 2.x, the official 'Motion for Vue' library) offers general-purpose animation primitives like the `<motion>` component and `v-motion` directive, `motion-plus-vue` provides ready-to-use, often complex, UI animation patterns building upon `motion-v`. Its release cadence is not explicitly stated, but the version number indicates active maintenance. A key differentiator is its focus on specific, advanced animation components that are part of the broader 'Motion Plus' ecosystem, leveraging the underlying `motion-v` for hardware-accelerated and smooth user interfaces.

Common errors

Warnings

Install

Imports

Quickstart

Shows a basic usage of the `<AnimateNumber>` component to display and animate a changing numeric value within a Vue 3 application.

<!-- App.vue -->
<script setup lang="ts">
import { ref } from 'vue';
// AnimateNumber is typically imported directly from motion-plus-vue
import { AnimateNumber } from 'motion-plus-vue';

const count = ref(0);

const increment = () => {
  count.value++;
};

const decrement = () => {
  if (count.value > 0) {
    count.value--;
  }
};
</script>

<template>
  <div class="container">
    <h1>Current Value: <AnimateNumber>{{ count }}</AnimateNumber></h1>
    <div class="controls">
      <button @click="increment">Increment</button>
      <button @click="decrement">Decrement</button>
    </div>
    <p>
      This example demonstrates the <code>&lt;AnimateNumber&gt;</code> component from <code>motion-plus-vue</code>.
      It animates the numeric value smoothly when the underlying `count` ref changes.
      The component internally leverages the <code>motion-v</code> animation engine for its effects.
    </p>
  </div>
</template>

<style scoped>
.container {
  font-family: sans-serif;
  text-align: center;
  padding: 20px;
  border: 1px solid #eee;
  border-radius: 8px;
  max-width: 400px;
  margin: 50px auto;
  box-shadow: 0 4px 8px rgba(0, 0, 0, 0.1);
}
h1 {
  margin-bottom: 20px;
  color: #333;
}
.controls button {
  background-color: #42b983;
  color: white;
  border: none;
  padding: 10px 20px;
  margin: 0 10px;
  border-radius: 5px;
  cursor: pointer;
  font-size: 16px;
  transition: background-color 0.3s ease;
}
.controls button:hover {
  background-color: #368d6f;
}
.controls button:active {
  background-color: #2b745a;
}
p {
  margin-top: 30px;
  font-size: 0.9em;
  color: #666;
  line-height: 1.5;
}
</style>

view raw JSON →