Jump to content
Search Community

Get Duration Draggable?

forzikdev 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

Can you elaborate a bit? Do you want to know the duration of the ThrowProps tween when the Draggable is flicked/released? Do you want to get the velocity of the x or y value? A directional vector that combines them? Can you give a brief summary of your goal and why you're asking the question? We'd love to help. 

Link to comment
Share on other sites

I'm a little confused, because you mentioned "duration" several times, but you also mention "speed" which typically means velocity. So here's an answer for both: 

 

Draggable.create("#knob", {
  type: "rotation",
  throwProps: true,
  onDragEnd: function() {
    console.log("rotational velocity: ", ThrowPropsPlugin.getVelocity(this.target, "rotation"), "degrees per second");
    console.log("rotational tween duration: ", this.tween.duration());
  }
});

 

See the Pen ?editors=0010 by GreenSock (@GreenSock) on CodePen

 

Does that help?

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