Jump to content
Search Community

Draggable update

potatoDie test
Moderator Tag

Recommended Posts

I'm a bit puzzled by the Draggable update function https://greensock.com/docs/v3/Plugins/Draggable/update(). It doesn't seem to do anything, even in Blake's demo

See the Pen JBwxjr by osublake (@osublake) on CodePen

Commenting out this.update() still works.

 

In my added Codepen I change the position of a draggable in 3 different ways, and either update is not needed, or it doesn't help.

 

See the Pen ZEWmKQq by potatoDie (@potatoDie) on CodePen

Link to comment
Share on other sites

  • 7 months later...

I'm so sorry about the super tardy response, @potatoDie ! I'm not sure how this slipped through the cracks. 

 

The reason you're seeing that issue is because you're not setting the transforms via GSAP (we ALWAYS recommend funneling all your transform-related stuff through GSAP because it's faster and more accurate, as explained here). 

 

You have three options in terms of solutions: 

  1. Set it via GSAP (by far the best)
    gsap.set(b2, {x: 0, y: 250, z: 0, scale: 1, rotation: 0});

     

  2. Clear the transforms via GSAP before you manually set it (to trigger GSAP to clear its cached values):
    gsap.set(b2, {clearProps: "transform"});

     

  3. Tell GSAP to re-parse the transforms (and use something like x: "+=0" just to trigger some kind of transform that must be parsed):
    gsap.set(b2, {parseTransform: true, x:"+=0"});

     

Let us know if you need anything else. 

  • Like 1
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...