# slot machine

I have the basic concept on how to loop through an array of numbers to achieve a slot machine like effect but was hoping someone would know what would be the best way to setup the actually scrolling animation and being able to lock into a certain position when the reels stop just like real slot machines. So I’m basically trying to find out the best way to do a slot machine spinning reel animation that both looks and acts like a slot machine.

There are probably many, many ways to achieve what you are looking for but the first one that comes to mind is to think of an individual spinner in the slot machine. This is basically a cylinder with (lets keep it simple) numbers on it. Lets imagine that there were 10 numbers on each spinner (keeping it simple). Since there are 360 degrees in a revolution, each number would occupy 36o of surface (360/10). Now, when you spin the spinner, it will rotate smoothly but … it must come to a stop with its center axis of rotation evenly divisible by 36o. This will ensure that a “clean” number shows to the end user. If you have other than 10 numbers, change the math appropriately.