Jump to content
GreenSock

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

Add CustomEase to TypeScript project.

Recommended Posts

I'm working on a project where we use TS and would like to add the CustomEase lib. 

 

We have added the GSAP through NPM and since CustomEase isn't part of it for some reason I have hard time to find a way to get it working. 

 

The error i recive is:

 !!! ERROR: browserify: Cannot find module '../TweenLite.js' from '/Users/myuser/Projects/myproject/src/ts'
Link to comment
Share on other sites

Are you installing GSAP through npm? If so, CustomEase isn't part of that package, so you will need to manually download it from your GSAP account and copy it into the GSAP modules folder for your project

 

And I'll post a type definition later so you won't get any TS compiler errors. In the meantime you can just do this.

declare var CustomEase;

.

  • Like 2
Link to comment
Share on other sites

For others who might get the same problem I did.

I have installed GSAP through npm. I then added the customEase lib 

"../.../vendor/customEase.min.js"

My customEase was then not able to find the TweenLite lib which it needs to work. 
In the customEase lib TweenLite is referred:

require("./TweenLite.js") 

So I just changed it to 

require("gsap") 

I also import the customeEase.min.js in my index.ts file.

 

In my greensock.d.ts i declared:

interface CustomEase {
    create(id:string, data:string):CustomEase;
    get(id:string):CustomEase;
    getRatio(progress:number):CustomEase;

}

declare var CustomEase:CustomEase;
  • Thanks 1
Link to comment
Share on other sites

Glad you got it working, but there's probably an easier way :) 

 

You should see a "commonjs-flat" directory in the download zip. That has all the dependencies set up in a flat structure, so you don't have to mess with the require() statements or anything. Or you could have just nested that CustomEase file you used into an "easing" subdirectory. But if I were you, I'd just use the commonjs-flat stuff :) 

Link to comment
Share on other sites

  • 6 months later...

Hi Blake, I've tried ways to add CustomEase and MorphSVGPlugin to my Angular 4 Typescript project but all failed to compile. So you were saying to "post a type definition later"... could you please help give some more advice in terms of using these paid plugins or functions in Angular? Thank you. 

Link to comment
Share on other sites

Hi @toricctan

 

Can you send me what you're working on so I can take a look? Just send me a PM if you don't want to post it here.

  • Like 1
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.
×