Jump to content
Search Community

NoahRodenbeek

Members
  • Posts

    8
  • Joined

  • Last visited

Posts posted by NoahRodenbeek

  1. No worry at all! Honestly, the more I thought about it, I think I prefer to load in GSAP separately. Aside from alleviating the TS import headache, it lets me lean on the cdn call for the base stuff which will be lightning fast for anyone who's gone pretty much anywhere on the internet before hitting my web app.

     

    Unrelated: for `@types/gsap` I had to add some stuff to RoughEase to make RoughEaseConfig work.

     

    declare class RoughEase extends Ease {
        public static ease: RoughEase;
        constructor(vars: RoughEaseConfig);
        public config(steps: number): SteppedEase;
        public config(vars: RoughEaseConfig): RoughEase; /** allows `ease: RoughEase.ease.config(configRoughEase)` */
    }

     

    ...someday I'll get around to submitting a PR for it

     

    • Like 1
  2. Updated my repo, I found a solution that I'm comfortable with but might not be satisfying to future troubleshooters.

     

    If I load GSAP from my index.html instead of TypeScript's import, it works great! It still requires @types/gsap to run but I don't get any type errors and the DrawSVG functionality is clicking along.

     

    I'd still be interested in helping find a TS-friendly solution, but I'm not in any dire straits for the moment.

    • Like 1
  3. Sorry, good call, didn't even think about that. GSAP removed and .gitignore'ed.

     

    I'm attaching the proof of concept I made beforehand. This is what I'm converting to teach myself TypeScript.

     

    The other GSAP stuff is working good in Vue. The Timeline runs, the final `.to()` fires fine, it's just the DrawSVG stuff gets skipped.

     

    Thanks again for your help!

     

     

    See the Pen jaWbRJ by nominalaeon (@nominalaeon) on CodePen

     

  4. Thank you so much for the fast and awesome reply!

     

    So I think this is the right track for sure, but my @types/gsap file must not be covering the right bases. Now I get this error:

     

    "error TS7016: Could not find a declaration file for module '../_vendor/gsap/DrawSVGPlugin'. '../_vendor/gsap/DrawSVGPlugin' implicitly has an 'any' type."

     

    I added this to the @types/gsap file:

     

    interface DrawSVGPlugin extends TweenPlugin {
        
    }
    
    ...
    
    declare var DrawSVGPlugin:DrawSVGPlugin;

     

    I just copied the BezierPlugin syntax, but maybe this isn't the right place to do it? There's a lot about TypeScript I still don't get :\

  5. I've got vanilla GSAP running with `yarn add gsap @types/gsap`, but I cannot figure out how to import the DrawSVG plugin. I've manually added it into a sibling directory called "_vendor/gsap" but the `import` just isn't working for me.

     

    I tried adding DrawSVG to the @types/gsap file and that made the errors go away but drawSVG still isn't doing anything.

     

    /** component.ts file */
    
    import * as GSAP from 'gsap';
    
    var trace = new GSAP.TimelineLite({ repeat: 0 });
    
    trace
      .fromTo($element, 6, {
        drawSVG: '0% 0%'
      }, {
        drawSVG: '0% 100%',
        ease: GSAP.Expo.easeInOut
      };

     

    Could be I've just been staring at this too long and not seeing something obvious. I found some good resources for base-model GSAP integration with TypeScript, but nothing about the paid tier plugins.

     

×
×
  • Create New...