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 🙏

© 2025 – Pkg Stats / Ryan Hefner

gsap-vue

v0.2.8

Published

Composable Vue 3 para usar GSAP con contexto (inspirado en @gsap/react)

Readme

@c5vagas/gsap-vue for using GSAP in Vue.js

GSAP Vue Banner

NPM Downloads npm version Vue 3 GSAP Demo Online

A Vue 3 Composable for using GSAP with context, inspired by @gsap/react.

Features

  • ✅ Fully compatible with Vue 3 Composition API
  • ✅ Automatic GSAP context handling and cleanup
  • ✅ Optional scope for selector text (no need for multiple refs)
  • ✅ Dependency tracking (reactivity-aware)
  • contextSafe for event listeners and delayed callbacks
  • ✅ Headless mode for SSR or non-browser environments

Installation

npm install gsap gsap-vue
# or
yarn add gsap gsap-vue

Basic Usage

<script setup lang="ts">
import { useGSAP } from "gsap-vue";
import { ref } from "vue";
import gsap from "gsap";

const box = ref<HTMLDivElement | null>(null);

useGSAP(() => {
  gsap.to(box.value, { x: 100, duration: 1 });
}, { scope: box });
</script>

<template>
  <div ref="box">Animated</div>
</template>

API

  • useGSAP(callback, config?) — Core composable for GSAP animations.
  • useGSAP.register(core: typeof gsap) — Replace GSAP core if needed.
  • useGSAP.headless = true — Enable headless mode for SSR or tests.

The config object supports:

  • scope → limits selector text to a container ref
  • dependencies → reactive dependencies to re-run animations
  • revertOnUpdate → revert context on dependency change

Examples

❌ Without useGSAP (manual)

<script setup lang="ts">
import { onMounted, onBeforeUnmount, ref } from "vue";
import gsap from "gsap";

const box = ref<HTMLDivElement | null>(null);
let ctx: gsap.Context | null = null;

onMounted(() => {
  ctx = gsap.context(() => {
    gsap.to(box.value, { rotation: 360, duration: 2 });
  }, box.value);
});

onBeforeUnmount(() => ctx?.revert());
</script>

<template>
  <div ref="box" class="box">Manual Animation</div>
</template>

✅ With useGSAP (simplified)

<script setup lang="ts">
import { useGSAP } from "gsap-vue";
import { ref } from "vue";
import gsap from "gsap";

const box = ref(null);

useGSAP(() => {
  gsap.to(box.value, { rotation: 360, duration: 2 });
}, { scope: box });
</script>

<template>
  <div ref="box" class="box">Easy Animation</div>
</template>

Using dependencies

<script setup lang="ts">
import { useGSAP } from "gsap-vue";
import { ref } from "vue";
import gsap from "gsap";

const box = ref(null);
const endX = ref(200);

useGSAP(() => {
  gsap.to(box.value, { x: endX.value, duration: 1 });
}, { dependencies: [endX], scope: box });

const moveFurther = () => {
  endX.value += 100;
};
</script>

<template>
  <button @click="moveFurther">Move Further</button>
  <div ref="box" class="box"></div>
</template>

contextSafe for event listeners

<script setup lang="ts">
import { useGSAP } from "gsap-vue";
import { ref } from "vue";
import gsap from "gsap";

const container = ref(null);

const { contextSafe } = useGSAP({ scope: container });

const onClick = contextSafe(() => {
  gsap.to(".box", { y: 100, stagger: 0.2 });
});
</script>

<template>
  <div ref="container">
    <button @click="onClick">Animate</button>
    <div class="box"></div>
    <div class="box"></div>
    <div class="box"></div>
  </div>
</template>

Scoped selector text

<script setup lang="ts">
import { useGSAP } from "gsap-vue";
import { ref } from "vue";
import gsap from "gsap";

const container = ref(null);

useGSAP(() => {
  gsap.from(".box", { opacity: 0, stagger: 0.1 });
}, { scope: container });
</script>

<template>
  <div ref="container">
    <div class="box"></div>
    <div class="box"></div>
    <div class="box"></div>
  </div>
</template>

Demo 🚀

👉🏼 Try the live demo

Check the demo folder for examples of usage.

Contributing

Contributions are welcome! Please fork the repository and submit a pull request.

License

MIT License © c5vagas