Sign in to follow this  
LordMysterious

Spin a wheel and land on specific segment

Recommended Posts

Hi All

I'm quite new to Pixi (as in this is day #2), I have a simple circle divided into segments (Wheel of Fortune style).

What I want to do is spin it, wait for a few seconds, slow down and stop on a specific segment, with a bit of bounce-back.

By the looks of things rotation itself is fairly straightforward, but how would I go about doing this?

Many Thanks

Share this post


Link to post
Share on other sites

Hi! Do you have any experience with Flash or any engine/renderer based on it? Pixi doesnt have big tutorials except https://github.com/kittykatattack/learningPixi . 

Also pixi doesnt have any animation functions from the box, you should use something like https://greensock.com/?product-plugin=js-pixiplugin , or you can write down formulas for bounce, code some javascript and put it in animation ticker.

Your task is too vague. Try to implement it, stumble across a bug, spend several hours on it, make a fiddle and post here, then people will help you :)

Share this post


Link to post
Share on other sites

One way to go about that type of thing is to start from the goal and calculate everything back to the start then playback everything. For example, pick the segment to stop to and register the position you need to be at (for a wheel probably degrees/radians), then calculate how many rotation you will need to run (for example start to segment = - n degrees + n number of turn = n * -360) then reverse all those number to positive (depends on direction of spinning) and start your wheel, your wheel will make n number of turn + n degrees to your segment position + then apply a small ease back and you are done.

Share this post


Link to post
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
Sign in to follow this  

  • Recently Browsing   0 members

    No registered users viewing this page.