Jump to content
Search Community

Simple way set scope (delayedCall/killTweensOf)

Igor test
Moderator Tag

Recommended Posts

Hello! Is it possible to easily set scope without storing additional variables?

For example in pixi.js I can do:

target.on('event', this.func, this); // this code inside the class. Last argument is scope (instance of class).

target.off('event', this.func, this); // no need to set id or store additional variables. Just also specify scope.

 

given that there is a lot of code in classes and often you need to specify the context, I think it's really more convenient, than:

  1. tween = gsap.delayedCall(1, this.func.bind(this)); gsap.killTweensOf(tween) // need to store a variable
  2. gsap.delayedCall(1, this.func.bind(this)).vars.id = 'id'; gsap.killTweensOf('id') // need to come up with id

 

I would like to see:
gsap.delayedCall(1, this.func, this);

gsap.killTweensOf(this.func, this);

Thanks for help:)

 

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...