Jump to content
GreenSock

Search In
  • More options...
Find results that contain...
Find results in...
forzikdev

Get Duration Draggable?

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 want to get the rotation speed of the item for display
Link to comment
Share on other sites

I use draggable simple code

 

// spin it
Draggable.create(spinner, {
    type: "rotation", 
    throwProps: true,
    minDuration: 5,
    maxDuration: 30,
    throwResistance: 100,
    overshootTolerance: 1
});
 

Link to comment
Share on other sites

 

I tried so but it does not work out 0

 

TweenLite.to("#wheel").duration();

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 4de37a6a70afd954a8549bebc1790e18 by GreenSock (@GreenSock) on CodePen

 

Does that help?

  • Like 2
Link to comment
Share on other sites

Yes, I did not confuse much until after the creation of the topic I realized!
 What exactly it was necessary to write speed!
 Thank you very much helped!

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