API Docs for: 0.1.0
Show:

ControlsGUI Class

Methods

createDiv

(
  • guiContainer
  • classes
  • callback
)
DOMElement

Creates a DIV and appends to the given DOMElement container.

Parameters:

  • guiContainer DOMElement

    The container to append the DIV to.

  • classes String

    The classname to give the DIV.

  • callback Function

    Optional callback function.

Returns:

DOMElement:

The newly created DIV.

createGUI

(
  • planetShortcuts
  • triggerAnimationParameter
)

Creates the GUI.

Parameters:

  • planetShortcuts Object

    Array of planet names and the keyboard shortcut to use to snap to them.

  • triggerAnimationParameter Function

    Provides a hook for updating animation after changing input values (@TODO - this is a code smell. Should decouple the animation from the GUI inputs.)

createInstructions

(
  • instructionsContainer
  • planetShortcuts
)

Parameters:

  • instructionsContainer DOMElement

    The DIV we need to populate with instructions.

  • planetShortcuts Object

    Array of planet names and the keyboard shortcut to use to snap to them.

createSlider

(
  • config
)

Creates a slider.

Parameters:

  • config Object

    Configuration object.

createSliders

(
  • guiContainer
)

Creates the sliders in the GUI.

Parameters:

  • guiContainer DOMElement

    Document element to insert the sliders in.

init

()

Initialises the GUI.

updateMillisecondsPerDay

()

Updates the value displayed to users when they change the number of milliseconds per day.

updateValueOfSliders

(
  • globalSlider
  • slidersToUpdate
)

Updates the value of all the given sliders. This way we can have one 'master' slider that controls all the others.

Parameters:

  • globalSlider String

    ID of the master slider.

  • slidersToUpdate Array

    Array of IDs of the sliders that should be updated when the master is updated.