npm package discovery and stats viewer.

Discover Tips

  • General search

    [free text search, go nuts!]

  • Package details

    pkg:[package-name]

  • User packages

    @[username]

Sponsor

Optimize Toolset

I’ve always been into building performant and accessible sites, but lately I’ve been taking it extremely seriously. So much so that I’ve been building a tool to help me optimize and monitor the sites that I build to make sure that I’m making an attempt to offer the best experience to those who visit them. If you’re into performant, accessible and SEO friendly sites, you might like it too! You can check it out at Optimize Toolset.

About

Hi, 👋, I’m Ryan Hefner  and I built this site for me, and you! The goal of this site was to provide an easy way for me to check the stats on my npm packages, both for prioritizing issues and updates, and to give me a little kick in the pants to keep up on stuff.

As I was building it, I realized that I was actually using the tool to build the tool, and figured I might as well put this out there and hopefully others will find it to be a fast and useful way to search and browse npm packages as I have.

If you’re interested in other things I’m working on, follow me on Twitter or check out the open source projects I’ve been publishing on GitHub.

I am also working on a Twitter bot for this site to tweet the most popular, newest, random packages from npm. Please follow that account now and it will start sending out packages soon–ish.

Open Software & Tools

This site wouldn’t be possible without the immense generosity and tireless efforts from the people who make contributions to the world and share their work via open source initiatives. Thank you 🙏

© 2024 – Pkg Stats / Ryan Hefner

vue-animated-counter

v0.3.0

Published

- Vue Animated Counter is a performant, dependency free and versatile Vue component that adds an animated counting feature to your Vue projects. This component is designed to provide a seamless and engaging user experience, allowing you to easily showcase

Downloads

394

Readme

Vue Animated Counter :zap:

  • Vue Animated Counter is a performant, dependency free and versatile Vue component that adds an animated counting feature to your Vue projects. This component is designed to provide a seamless and engaging user experience, allowing you to easily showcase important metrics or data points in an elegant and visually appealing way.

Features ✨

  • Animated counting: The Vue Animated Counter animates the counting process, providing a smooth and engaging visual effect for your users.

  • Customizable duration : You can set the duration of the animation to suit your needs and preferences. This feature allows you to adjust the animation speed to match the tone and pace of your project.

  • Automatic Viewport detection: The animation starts when the component is in the viewport, creating a more interactive and user-driven experience.

  • Flexible and easy to use : With just two required props, the Vue Animated Counter is easy to integrate into your Vue projects, making it a versatile and valuable addition to your toolkit.

Usage with Vue 3

npm install vue-animated-counter

After installation, register the component globally as shown below

import { createApp } from 'vue'
import App from './App.vue'
import './assets/main.css'
import AnimatedCounter from "vue-animated-counter"
const app = createApp(App)
app.component("AnimatedCounter", AnimatedCounter);
app.mount('#app')

and use it as follows:

<template>
  <div>
    <AnimatedCounter :value="500" :duration="1000" class="counter"/>
  </div>
</template>
<style>
.counter {
  font-size: 40px;
}
</style>

Usage with Nuxt 3

npm install vue-animated-counter

After installation, register the component as a Nuxt plugin. You can read more about Nuxt plugins here. Create a plugin file plugins/animatedCounter.client.ts. We are using the .client prefix to tell Nuxt that our plugin should only be used in the client side. Register the AnimatedCounter component as shown below :

// plugins/animatedCounter.client.ts
import AnimatedCounter from 'vue-animated-counter';
export default defineNuxtPlugin(nuxtApp => {
    nuxtApp.vueApp.use(AnimatedCounter)
})

then in your components directory create a CounterComponent.vue file ( You can name it whatever you want ) and wrap the AnimatedCounter component inside the <ClientOnly/> component as shown below :

//components/CounterComponent.vue
<template>
    <div>
        <ClientOnly>
            <AnimatedCounter :value="500" :duration="1000" class="counter" />
        </ClientOnly>
    </div>
</template>
<style>
.counter {
  font-size: 40px;
}
</style>

we are using the <ClientOnly/> component to render our AnimatedCounter component only in the client side. You can read more about the ClientOnly component here

Props

  • value: The value prop is used to specify the final value that the counter should animate towards. This can be any numerical value, and the counter will count up from 0 to this value over the specified duration.

  • duration: The duration prop is used to set the length of time in milliseconds that the counter animation should take. This allows you to adjust the speed of the animation to suit the pace and tone of your project.

Conclusion

  • Vue Animated Counter is a powerful and versatile tool for Vue developers who want to add an elegant and engaging animated counting feature to their projects. With its customizable duration and viewport detection, this component provides an effective and efficient way to showcase important metrics or data points in a visually appealing and interactive way.