Jump to content
Search Community

Importing CustomEase and CustomBounce to React

Luckyde test
Moderator Tag

Warning: Please note

This thread was started before GSAP 3 was released. Some information, especially the syntax, may be out of date for GSAP 3. Please see the GSAP 3 migration guide and release notes for more information about how to update the code to GSAP 3's syntax. 

Recommended Posts

Quick question sorry,

After importing gsap via https://www.npmjs.com/package/gsap
And I'm also trying to add the customEase and customBounce in, but it's not quite letting me.

I tried to directly copy those 2 to the node_modules/gsap folder but it can't really access them

1369312007_ScreenShot2019-06-07at9_04_09AM.png.78dcf54b73e237fa7011be63a8b36eb2.png

1497627080_ScreenShot2019-06-07at9_04_05AM.png.a01e548a43484a50d86bb23cc6a5ab27.png

 

Do I need to edit the Ease.d.ts? I noticed that this is where some ease information is stored e.g.

 

 


    class Sine extends Ease {
        static easeIn: Sine;
        static easeInOut: Sine;
        static easeOut: Sine;
    }

    class SlowMo extends Ease {
        static ease: SlowMo;
        config(linearRatio: number, power: number, yoyoMode: boolean): SlowMo;
    }

    class SteppedEase extends Ease {
        constructor(staps: number);
        config(steps: number): SteppedEase;
    }

 

Thanks! :D

Link to comment
Share on other sites

Didn't seem to do it , still doesn't recognise it as a module. This is react Native, using typescript if it makes a difference in importing, I tried to enable customEase and customBounce from all.js too
Tried doing it in 2 ways, both dont seem to work

 

Screen Shot 2019-06-07 at 10.17.29 AM.png

Link to comment
Share on other sites

4 minutes ago, OSUblake said:

import "gsap/CustomEase";

declare var CustomEase;

Try it like that. It's the same issue here.

 

getting this error from that

'CustomEase' is declared but its value is never read.ts(6133)
Variable 'CustomEase' implicitly has an 'any' type.ts(7005)
 
Quote

 

 

Link to comment
Share on other sites

That makes sense,I took out the customBounce part and just stuck with a custom ease now (had to give it a default type)

import { TimelineMax } from 'gsap';
import 'gsap/CustomEase'; 
let CustomEase:null;

 

if I use 'declare var CustomEase' it tells me 

Variable 'CustomEase' implicitly has an 'any' type.ts(7005)

 

But if I use the let it never gets reasigned and on testing the import gsap/customEase function gives me this error(and the file's definetly there, and i did restart)


1656485252_ScreenShot2019-06-07at10_36_13AM.png.839a75254ea2f203edcb7fa2c4128271.png

 

Maybe I could fetch it separately instead if putting it in the node_modules folder and link it to gsap somehow?

Link to comment
Share on other sites

4 minutes ago, Luckyde said:

Maybe I could fetch it separately instead if putting it in the node_modules folder and link it to gsap somehow?

 

I don't like the idea of copy stuff into the node_modules folder, but it really doesn't matter where you fetch the files from from.  It sounds like TypeScript is just be picky. You may need to adjust some settings in your tsconfig file.

 

If you still have problems, just send me a something I can look at. It's way too hard to troubleshoot blind. 

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