Passing parameters through the onComplete property of a tween

Hello all! I was wondering if there was any way to pass a parameter through the onComplete property of a tween? I am coming from C# (Unity refugee) so I am trying to wrap my head around Typescript/Javascript. This is a snippet of my code:

            tween(this.fadeOpacity)
                .to(this.fadeLength, { opacity: 0 }, { onComplete: this.DisableObject })
                .start();

However, the DisableObject is expecting a Node parameter, like this:

    DisableObject(item: Node) {
        item.active = false;
    }

Sorry if this is a silly question, but I am new to Typescript and just can’t seem to find an answer anywhere.

Refer to the code below to modify:

tween(this.fadeOpacity)
          .to(this.fadeLength, { opacity: 0 }, { onComplete: this.DisableObject.bind(this, item) })
          .start();
1 Like

That worked perfectly!! Thank you! :slight_smile: