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

@zlxiao97/gsap-transition-anim-vue

v1.0.0

Published

A JavaScript library for creating smooth entrance and exit animations for visual screens.

Downloads

1

Readme

@zlxiao97/gsap-transition-anim-vue

npm version License

A JavaScript library for creating entrance and exit animations for visual screens. This library is designed to work seamlessly with Vue and vue-router, and utilizes the power of GSAP for smooth animations.

Features

  • Create engaging entrance and exit animations for your visual screen applications.
  • Seamlessly integrate with Vue and vue-router-dom.
  • Utilize the animation capabilities of GSAP for high-quality animations.
  • Easily customize and configure animations to match your application's design.

Installation

Make sure you have Vue and vue-router-dom installed in your project before using this library. You can install the library via npm:

npm install vue vue-router-dom @zlxiao97/gsap-transition-anim-vue

Usage

  1. Import the necessary hook from the library:
import { useAnimation } from "@zlxiao97/gsap-transition-anim-vue";
  1. Use the useAnimation hook in your components. The animations will be triggered when your component is added to the DOM or your component will be removed from the DOM, For more details, check the Reference:
export default () => {
  const [ids] = useAnimation([
  { targets: ["l1", "l2"], vars: { x: "-500px" } },
  {
    targets: ["r1", "r2"],
    vars: { x: `${screenWidth + 500}px` }
  },
  {
    targets: ["m1"],
    vars: { y: `-600px` }
  }
  ]);
  const {l1, m1, r1, l2, r2 } = ids
  return (
    <div>
      <div id={l1}>l1</div>
      <div id={m1}>m1</div>
      <div id={r1}>r1</div>
      <div id={l2}>l2</div>
      <div id={r2}>r2</div>
    </div>
  );
};
  1. use our useNavigate hook to replace Vue Router's:
// replace:
import { useRouter } from "vue-router";

const router = useRouter()
router.push(pathName)
// to:
import { useNavigate } from "@zlxiao97/gsap-transition-anim-vue";

const navigate = useNavigate()
navigate(pathName)

Reference

useAnimation Hook

The useAnimation hook allows you to register entrance and exit animations for elements within your visual screens. It simplifies the process of animating elements on entrance and exit without requiring you to explicitly specify the end state of animation.

Parameters

  • animationConfig (Array): An array of animation configuration objects.

Animation Configuration Object

Each object in the animationConfig array should have the following properties:

  • targets (string): A readable and non-repetitive identification string key, you don't have to use a library like uuid to generate it, you can pass this identifier as a key to get the auto-generated element id in the ids object returned by useAnimation and bind it to the animated element.
  • vars (object): An object containing all the properties/values you want to animate. This represent the initial state of the animation.

Tips

  • Exit animations are automatically generated based on the provided entrance animation configurations. The exit animation's initial properties will be the same as the final state of the entrance animation.

Example

For a complete example of using the library, check out our demo application.

License

This project is licensed under the MIT License - see the LICENSE file for details.