zarocknz/javascript-winwheel

Is there a way we can animate the wheel without TweenMax and stop at particular angle?

Closed this issue · 1 comments

Hi,

You have done a great work with winwheel and I am working on something of similar nature, where I need to rotate the wheel and stop at a particular angle I can see you are uring TweenMax to achieve that. Is there a way it can be done without TweenMax or may be any other library.

Hi @ashokyadav006. Thank you for your kind words.

I chose TweenMax because it can animate any numeric property over time and Winwheels have heaps of numeric properties such as rotationAngle, outerRadius etc so it was a good match for what I wanted to do.

Yes you should be able to animate without TweenMax, I do remember there were other libraries with "Easing" type animations out there at the time, or if you are good at math you might be able to write your own animation functions.

In either case you will not be able to use the built in animation properties and methods of Winwheel.js since those are wrappers around TweenMax configuration. You will need to call your own function on trigger of the animation which either configures another animation library or contains the code to alter the Winwheel properties over time.

One of the key things to see the animation is to have a Winwheel.draw() function call inside an animation loop. If you don't know about it already look up "requestAnimationFrame" in your favorite search engine - inside this function is where the Winwheel.draw() function call should go.

Hope that helps.

Kind regards,
DouG.