Jump to content


Slot macihne spin animation

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 wanted to make a slot macihne and I have this result. I have 2 bug in this code. 

  1. When the random function drop the same numbers, the slot don't spin.
  2. How could I make a fluid spin, because increase the spin number to 10-15 spins (with random function) can cause empty wheel. 

Thanks for the help.

See the Pen BGevPd by szsoma (@szsoma) on CodePen

Link to comment
Share on other sites

Try to duplicate your lists multiple times.  Example list: [1-2-3]-[1-2-3]-[1-2-3]-[1-2-3]-[1-2-3]

For example duplicate the list at the end 4 times, generate a random number between [1-3] for example 2, then generate another random number between 1-4 for the group. For example 3. In this case [1-2-3]-[1-2-3]-[1-2-3]-[1-2-3]-[1-2-3] the target number is the 2 in the 4th group. Animate your wheel to spin to that number and when the animation onComplete, reset back the wheel to the first group's 2nd element. [1-2-3]-[1-2-3]-[1-2-3]-[1-2-3]-[1-2-3] The user won't notice this reset as the content will be the same and they can spin again :)

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.