Jump to content


Draggable- Bounds and last rotation info

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

I am creating a barometer that has an interactive needle for the user to adjust. I used the draggable type rotation to set it to spin, however when I tried putting in the bounds, (bounds:{minRotation:0, maxRotation:90}), it is not recognizing the bounds at all. Also, when I have tried to get the info on where the needle's last rotation degree lands (onDragEnd:function() { console.log(this.rotation);}), the console logs it as undefined. Any clues why this is not being applied?

function init()
	needleImg= document.getElementById("bNeedle");

	TweenMax.to(needleImg, 3, {css:{rotation:145, transformOrigin:"193px 47px"},ease:Elastic.easeOut});

        onDragEnd:function() { console.log(this.rotation);},
        bounds:{minRotation:0, maxRotation:90}

Edited by ErinD
Link to comment
Share on other sites



Mhh I'm not sure what could be wrong your code seems ok to me, at least the part you posted.


Anyway I've created a very simple codepen with a very old-fashion needle, feel free to fork it and accommodate it to your scenario:


See the Pen nhfgv by rhernando (@rhernando) on CodePen



Link to comment
Share on other sites

I bet you're just using a stale version of Draggable (before it had those features). Please make sure you're using the latest version (that goes for all the GreenSock files)

  • Like 1
Link to comment
Share on other sites

Yes! That did it, Jack. Didn't realize I was running an older copy. Thanks to both of you for your help!


Happy Holidays,



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.