IvanAdmaers / react-roulette-pro

The best React roulette
https://react-roulette-pro.ivanadmaers.com/
MIT License
63 stars 15 forks source link

Change the animations "speed" #17

Closed lxnnydev closed 1 year ago

lxnnydev commented 2 years ago

Enough with the ironic issues 😅

If I am only animating/spinning 3 items or even 2, it turns out to be really slow, but if I spin over 20 it's way faster and looks a lot nicer! Is there any way to change it?

IvanAdmaers commented 2 years ago

If there are only two or three prize items you will need to increase it. The roulette works fine if there are enough prize items passed via the ‘prizes’ prop. If I didn’t get you right provide an example of code

lxnnydev commented 2 years ago

Is there a way of duplicating the price items, so 2 items would "act" like 4? (possibly even higher)

IvanAdmaers commented 2 years ago

Of course. In this usage example is a function:

const reproductionArray = (array = [], length = 0) => [
  ...Array(length)
    .fill('_')
    .map(() => array[Math.floor(Math.random() * array.length)]),
];

You can use it