mwg API
    Preparing search index...

    Class Slider

    A draggable knob on a track, for a volume, difficulty or zoom setting.

    The track is drawn from the theme and a partial fill shows where the knob is; the value is always a number in [min, max], and sliderValueAt is the arithmetic that turns a click or drag into one, exported so a game routing input itself gets the same snapping.

    import { Slider } from '@datamoc/mw_games/two-d/ui';

    const volume = new Slider({ width: 200, min: 0, max: 100, step: 5, value: 40 });
    volume.onChange.add((value) => console.log('volume', value));
    volume.setValue(75);

    Hierarchy

    • Container
      • Slider
    Index
    onChange: Signal<number> = ...
    • Removes all internal references and listeners as well as removes children from the display list. Do not use a Container after calling destroy.

      Parameters

      • Optionaloptions: DestroyOptions

        Options parameter. A boolean will act as if all options have been set to that value

      Returns void

      container.destroy();
      container.destroy(true);
      container.destroy({ children: true });
      container.destroy({ children: true, texture: true, textureSource: true });
    • Parameters

      • width: number
      • height: number

      Returns void

    • moves the knob to a 0-to-1 position, the arithmetic a track click uses

      Parameters

      • fraction: number

      Returns void