Jump to content
Search Community

Installing gsap-bonus in ejected React Project

DavTho test
Moderator Tag

Recommended Posts

I want to use the bonus plugin MotionPathPlugin. I moved the gsap-bonus.tgz file from the extracted download zip to my local project directory and ran npm install --save ./gsap-bonus.tgz. Then in my package.json I get the line:

 

 "gsap""file:gsap-bonus.tgz",

 

This doesn't seem right, and when I try npm start to run the project, I get

 

'MotionPathPlugin' is not defined

 

How do I use MotionPathPlugin in React?

 

Link to comment
Share on other sites

Hey Dav.

 

5 minutes ago, DavTho said:

This doesn't seem right

Why is that? That way NPM knows where to find all the GSAP files including CustomEase.

 

5 minutes ago, DavTho said:

when I try npm start to run the project, I get "'MotionPathPlugin' is not defined". How do I use MotionPathPlugin in React?

We highly recommend using our Install Helper if you're having trouble importing GSAP or parts of it. Selecting MotionPath with ES Modules selected will generate the following code:

import { gsap } from "gsap";
import { MotionPathPlugin } from "gsap/MotionPathPlugin";

gsap.registerPlugin(MotionPathPlugin);

You likely are not importing it and/or registering it :) 

  • Like 3
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.
×
×
  • Create New...