Jump to content
Search Community

Rotation draggable knob

zozo
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

Posted

Hi, 

 

I would like to make a knob that rotate and that can be draggable, and when released, start the rotation again from where it was left at the release moment. 

I tried many thing, but can't seem to find the right way to do it. 

Thanks for the help !

 

See the Pen ajzBym by romainmalauzat (@romainmalauzat) on CodePen.

Posted

Hi and welcome to the GreenSock forums

 

I wasn't exactly sure what you are asking but if you want to have an element that you want to drag (up and down) and also rotate please consult the demo below from our friend @Diaco

 

I had to fork his original to add an updated version of GSAP and set allowEventDefault:true (to allow the mousedown events).

 

The basic idea is that you have 2 Draggable instances and you toggle their enabled state

 

See the Pen LBmLbr by GreenSock (@GreenSock) on CodePen.

 

In the future its best to write actual JS (as opposed to coffeescript) so that more people can make sense of what you are trying to do.

 

 

  • Like 3
Posted

Hi Thanks, it seem I didn't explained myself clearly.  I corrected the pen to make it more clear, and in plain js. 

What I want is the knob to rotate continuously, that's easy. 

Then I want to make the knob draggable, easy too.  

Finally I want that when we release the knob, it resume the rotation, from where we left the knob. Not easy :)

Thanks ! 

 

Posted

Hi @zozo :)

 

We just had a similar question that can probably help. Please check out this thread:

 

 

Happy tweening.

:)

 

  • Like 3
Posted

thanks ! it's seem very similar yes. I finish something and I read more in depth. 

Always happy to tween ;)

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