Jump to content
GreenSock

Search In
  • More options...
Find results that contain...
Find results in...
Pixelcaps

ModifiersPlugin import for gsap 2

Recommended Posts

Hello, I am getting this error for an animation -> invalid modifiers tween value: [object Object]. I am using gsap version 2 inside a React project. I've read from another forum post that its because the plugin is not loaded. My question is how do you load it inside an actual project, not codepen? 

Link to comment
Share on other sites

Hi Pixelcaps - Firstly. Is there a reason you're using GSAP 2?

  • Like 1
Link to comment
Share on other sites

3 hours ago, Cassie said:

Hi Pixelcaps - Firstly. Is there a reason you're using GSAP 2?

 

I'd second that. Most of the v2 syntax will work in v3, and the rest is pretty easy to convert using our Migration Guide.

 

If you must use v2, you would just import like every other plugin. The only difference is that there is no registration of the plugin, so you should add the plugin to a dummy value so it doesn't get dropped due to tree shaking.

 

import { TweenMax } from "gsap";
import { ModifiersPlugin } from "gsap/ModifiersPlugin";

const plugins = [ModifiersPlugin];

TweenMax.to("#foo", 1, {
  x: 100,
  modifiers: {
    ...
  }
})

 

  • Like 2
Link to comment
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
  • Recently Browsing   0 members

    • No registered users viewing this page.
×