Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat: add new registerEffects option #43

Merged
merged 1 commit into from
May 6, 2023
Merged

Conversation

ivodolenc
Copy link
Member

Type of Change

  • New feature
  • Documentation

Request Description

Adds new registerEffects option that provides an easy way to register global effects.

Register Effects

// nuxt.config.ts

{
  gsap: {
    registerEffects: [
      {
        name: 'fade',
        defaults: {
          y: -100,
          opacity: 0,
          duration: 2
        },
        // eslint-disable-next-line
        // @ts-ignore
        effect: (targets, config) => {
          return gsap.to(targets, {
            y: config.y,
            opacity: config.opacity,
            duration: config.duration
          })
        }
      },
      {
        name: 'slideIn'
        // ...
      }
    ]
  }
}

Available globally

const { $gsap } = useNuxtApp()

$gsap.effects.fade('.class')
$gsap.effects.slideIn('#id')

Additional Details

It also updates the documentation.

@ivodolenc ivodolenc added docs Documentation feat New feature labels May 6, 2023
@ivodolenc ivodolenc merged commit 6cf7929 into main May 6, 2023
@ivodolenc ivodolenc deleted the feat/register-effects branch May 6, 2023 12:26
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
docs Documentation feat New feature
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant