Skip to content

Initialization Options

Kir_Antipov edited this page Aug 3, 2019 · 1 revision

VanillaRoulette Initialization Options

This page contains information about initialization options' structure.

Default values

You can immediately see the entire list of available options, if you'll take a look at this object with the default values:

let options = { 
    spacing = 10, 
    acceleration = 350, 
    fps = 40, 
    audio = "libs/vanillaRoulette/click.wav",
    selector = ":scope > *",
    stopCallback = null,
    startCallback = null
};

Now let's look at each parameter individually :)

spacing

  • Default value: 10
  • Description: The distance between two prizes in roulette (in pixels)

acceleration

  • Default value: 350
  • Description: Roulette acceleration coefficient (in fact, this is a deceleration coefficient, but deceleration is a special case of acceleration 😺). The value of this parameter is directly proportional to the initial roulette speed!

fps

  • Default value: 40
  • Description: Frames Per Second, as usual. I highly recommend using values ​​between 40 and 240

audio

  • Default value: "libs/vanillaRoulette/click.wav"
  • Description:

Each time a roulette passes new prize, a click sound is played. You can control which sound will be played by this option. You can use the following values:

  • null: Sound will not play
  • "some/string": Link to sound for playing
  • object: If you need a special logic for playing sound, you can transfer here an object for which the play function is defined

selector

  • Default value: ":scope > *"
  • Description: Roulette child selector

stopCallback

  • Default value: null
  • Description: The function that will be called when the roulette will be stopped

You can read more about callbacks here.

startCallback

  • Default value: null
  • Description: The function that will be called when the roulette will be started

You can read more about callbacks here.