Jump to content
Search Community

Draggable, Throw, and onThrowUpdateScope

bm1967 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

Hi

 

Using Draggable with throwProps I keep checking on a 'thrown' objects coords using onThrowUpdate.

 

My problem is based on needing a reference to two scopes.

 

One scope being the object that's thrown (the throw scope) and the other is the scope that I set in onThrowUpdateScope.

 

If I set "onThrowUpdateScope: this" so as it references my object and all my prototyped methods then I can't seem to reference the object with the 'throw' scope.

 

I would be very grateful if someone can show me how this is done...

 

Many thanks in advance...

Link to comment
Share on other sites

Hi,

 

I'm having a little trouble following your question, maybe the few neurons that still work in my brain are spinning in the wrong way  :mrgreen:. Maybe you could set up a simple codepen in order to get a better grasp of what the issue could be.

 

http://forums.greensock.com/topic/9002-read-this-first-how-to-create-a-codepen-demo/

 

Finally keep in mind that inside the Draggable instance, this refers to the instance itself and this.target refers to the DOM element being dragged/thrown.

Link to comment
Share on other sites

Hi

 

Thank you for your reply.

 

I've put together a short example of what I mean in CodePen.

 

To see what I mean, drag and throw the object. One line of output is correctly referenced, the other is undefined.

 

See the Pen KkfIo by anon (@anon) on CodePen

 

Basically I want my ScreenController.prototype.onThrowUpdate function to be able to access both scopes, ie, the scope of the throwprops object and also the scope defined in onThrowUpdateScope.

 

Hopefully that's more clear.

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