hypernym-studio / nuxt-gsap

GSAP module for Nuxt.
MIT License
292 stars 12 forks source link

feat: add new `registerEases` option #44

Closed ivodolenc closed 1 year ago

ivodolenc commented 1 year ago

Type of Change

Request Description

Adds new registerEases option that provides an easy way to register global eases.

Register Eases

// nuxt.config.ts

{
  gsap: {
    registerEases: [
      {
        name: 'customEase',
        ease: progress => {
          return progress // linear
        }
      },
      {
        name: 'customEase2'
        // ...
      }
    ]
  }
}

Available globally

const { $gsap } = useNuxtApp()

$gsap.to('.class', { x: 100, ease: 'customEase' })
$gsap.to('#id', { x: 200, ease: 'customEase2' })