This package, `animated-number-vue` (version 1.0.0), provides a Vue 2 component designed to animate numerical values. It leverages the `animejs` library for its animation engine, offering smooth transitions for displaying numbers like prices, scores, or counts. Key features include configurable animation duration, delay, easing functions, and a `formatValue` prop for custom output formatting (e.g., currency, percentages). It also exposes callback props (`update`, `run`, `begin`, `complete`) for reacting to different stages of the animation lifecycle. Its primary differentiator is its simplicity and direct integration with Vue 2 projects, specifically using `animejs` for animation control. Given its explicit targeting of Vue 2, it is considered to be in a maintenance state, without active development or official support for Vue 3 or newer versions of the framework.
npm install animated-number-vueVerified import paths — ran on the pinned version, not inferred.
This quickstart demonstrates how to import and use the AnimatedNumber component within a Vue 2 Single File Component, setting a dynamic value and applying a custom formatting function.
For Vue 3 projects, seek out a different animation library or rebuild the functionality using Vue 3's composition API or a compatible animation library. If you must use this package, ensure your project remains on Vue 2.
If passing a string, ensure it's a valid number string that can be parsed, or convert it to a number within your component's logic or the `formatValue` callback if numerical operations are needed.
Refer to the official `animejs` documentation (https://animejs.com/documentation/) for current easing functions to ensure your `easing` prop value is valid.
Ensure `AnimatedNumber` is imported and registered locally within your component's `components` option, or globally via `Vue.component('animated-number', AnimatedNumber);` if using Vue 2. If in Vue 3, this package is incompatible.Always use `import AnimatedNumber from 'animated-number-vue';` within Vue Single File Components or JavaScript modules. Avoid `const AnimatedNumber = require('animated-number-vue');`.