Jump to content
GreenSock

mikefosbrook

Draggable - rotation - callback on use of Tweenlite.to()

Moderator Tag
Go to solution Solved by Diaco,

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 have a dial I wish to retrieve the rotation value from after a submit button is clicked. A user can rotate the dial and upon clicking the button the dial should animate to the update position and the percentage value use the calculateAngle.

 

I've tried retrieving all manner of properties from the Spinner object itself and the tweenlite object but I can't get a dynamic value, always returns the end rotation value but I want it to poll the rotation in the same way that the percentage value updates when you directly interact with the dial.

 

The reason I want the value to animate is I wish to re-use the animated value to animate a pie chart type fill which will be overlaid on top of the dial.  

 

 

See the Pen XJrLXm by anon (@anon) on CodePen

Link to comment
Share on other sites

  • Solution

Hi mikefosbrook  :)

 

try this :

function tweenCalc(){
calcPercent (Draggable.get(".circle").target._gsTransform.rotation);
};
$('.submit').on('click', function() {
TweenLite.to( $('.circle'), 1,{rotation:90,onUpdate:tweenCalc});
});

pls check this out :

 

See the Pen gbYVPN by MAW (@MAW) on CodePen

  • Like 2
Link to comment
Share on other sites

This is fantastic, thank you so much Diaco.AW. Gives me a lot to play about with now.

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