Jump to content
Search Community

StGewehr

Members
  • Posts

    5
  • Joined

  • Last visited

Posts posted by StGewehr

  1. Hi @OSUblake !

     

    My thanks for quick response. Actually, I was very close, I just split declaration and addition of a method to prototype into different files, and it works fine.

    So it should look something like this (perhaps for those who find this topic).

     

    //some index.ts
    
    /// <reference path="./utils/extensions/gsap.d.ts"/>
    import "./utils/extensions/gsap.extensions";
    
    
    //gsap.d.ts
    declare namespace gsap.core {
      export interface Timeline {
        deepKill(): void;
      }
    }
    
    //gsap.extensions.ts
    import { gsap } from "gsap";
    
    gsap.core.Timeline.prototype.deepKill = function () {
      this.getChildren(true, true, true).forEach((animation) => animation.kill());
      this.kill();
    };

     

    Thanks,

    Yury

    • Haha 1
  2. Hi!

     

    I feel that it would be very handy, if I can extend the prototype of gsap.core.Timeline, and add TypeScript typings for these extension methods.

    For example, this way I can add typing for the "effects" (with extendTimeline = true).
    Or, like the "deepKill" method that was suggested by @Greensock.

     

    Here's what I'm trying to do:

    1629479299_Screenshot2021-03-31at14_24_06.thumb.png.fd0f42c1fd446a3cebb7436ef36d4aa4.png

     

    Are there any proper way? That "deepKill" call on the left should be "yellow" if it is caught by TS typing system.

     

    Thank you!

  3. Hi guys,

     

    First of all, thank you for amazing tool!

     

    My question is about the onInterrupt callback, I put them on multiple nested timelines. Then I ".kill ()" the root timeline and expect that ALL onInterrupt will be called. At the moment, it works only on the root.

     

    Are my expectations wrong?

    The idea is that I have some structure of nested objects, and each object returns its own part of the animation, and I want to use onInterrupt to do clean up inside this "node tree". Otherwise ... I have to find all the children and kill them one by one? Or keep references to them while preparing the timeline, which will result in dirty code.

     

    Many thanks!

     

     

    See the Pen abpdJKw by StGewehr (@StGewehr) on CodePen

×
×
  • Create New...