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

@marcreichel/alpine-auto-animate

v1.1.0

Published

An Alpine.js wrapper for @formkit/auto-animate.

Downloads

4,065

Readme

🚀 Installation

CDN

Include the following <script> tag in the <head> of your document, just before Alpine.

<script src="https://cdn.jsdelivr.net/npm/@marcreichel/alpine-auto-animate@latest/dist/alpine-auto-animate.min.js" defer></script>

NPM

npm install @marcreichel/alpine-auto-animate

Add the x-auto-animate directive to your project by importing the package before starting Alpine.

import Alpine from 'alpinejs';
import AutoAnimate from '@marcreichel/alpine-auto-animate';

Alpine.plugin(AutoAnimate);

Alpine.start();

🪄 Usage

Add the x-auto-animate directive to any element where you want to apply animations (including their direct children).

<ul x-auto-animate>
    <li>Lorem</li>
    <li>Ipsum</li>
</ul>

Duration

To adjust the animation duration add a modifier like so:

<ul x-auto-animate.1000ms>
    <!-- ... -->
</ul>

or

<ul x-auto-animate.1s>
    <!-- ... -->
</ul>

Easing function

To adjust the easing function add it as a modifier:

<ul x-auto-animate.linear>
    <!-- ... -->
</ul>

Toggle animations

In some situations it may be necessary to disable animations and re-enable them later.

For this you can provide a boolean to the directive like so:

<div x-data="{ enabled: true }">
    <ul x-auto-animate="enabled">
        <!-- ... -->
    </ul>
    <button @click="enabled = !enabled" type="button">
        Toggle animations
    </button>
</div>

Global config

If you are using the npm installation method for this package or the ESM distribution, you can use the AutoAnimate.configure method to provide a configuration:

import AutoAnimate from '@marcreichel/alpine-auto-animate';

Alpine.plugin(AutoAnimate.configure({
    duration: 1000,
    easing: 'linear',
    disrespectUserMotionPreference: true,
}));

📄 License

Copyright (c) 2022 Marc Reichel and contributors.

Licensed under the MIT license, see LICENSE for details.