View Source Scenic.Component.Input.Slider (Scenic v0.11.2)
Add a slider to a graph
data
Data
{ extents, initial_value}
extentsgives the range of values. It can take several forms...{min, max}Ifminandmaxare integers, then the slider value will be an integer.{min, max}Ifminandmaxare floats, then the slider value will be an float.[a, b, c]A list of terms. The value will be one of the terms
initial_valueSets the initial value (and position) of the slider. It must make sense with the extents you passed in.
messages
Messages
When the state of the slider changes, it sends an event message to the host scene in the form of:
{:value_changed, id, value}
options
Options
Sliders honor the following list of options.
styles
Styles
Sliders honor the following styles
:hidden- Iffalsethe component is rendered. Iftrue, it is skipped. The default isfalse.:theme- The color set used to draw. See below. The default is:dark
theme
Theme
Sliders work well with the following predefined themes: :light, :dark
To pass in a custom theme, supply a map with at least the following entries:
:border- the color of the slider line:thumb- the color of slider thumb
usage
Usage
You should add/modify components via the helper functions in
Scenic.Components
examples
Examples
The following example creates a numeric slider and positions it on the screen.
graph
|> slider({{0,100}, 0}, id: :num_slider, translate: {20,20})The following example creates a list slider and positions it on the screen.
graph
|> slider({[
:white,
:cornflower_blue,
:green,
:chartreuse
], :cornflower_blue}, id: :slider_id, translate: {20,20})
Link to this section Summary
Functions
Callback implementation for Scenic.Component.add_to_graph/3.
Returns a specification to start this module under a supervisor.
Link to this section Functions
Callback implementation for Scenic.Component.add_to_graph/3.
Returns a specification to start this module under a supervisor.
See Supervisor.