Reference createSlider()

createSlider()

Creates a slider <input> element.

Range sliders are useful for quickly selecting numbers from a given range.

The first two parameters, min and max, are numbers that set the slider's minimum and maximum.

The third parameter, value, is optional. It's a number that sets the slider's default value.

The fourth parameter, step, is also optional. It's a number that sets the spacing between each value in the slider's range. Setting step to 0 allows the slider to move smoothly from min to max.

Examples

Syntax

createSlider(min, max, [value], [step])

Parameters

min
Number:

minimum value of the slider.

max
Number:

maximum value of the slider.

value
Number:

default value of the slider.

step
Number:

size for each step in the slider's range.

Returns

p5.Element: new p5.Element object.
Notice any errors or typos? Please let us know. Please feel free to edit src/dom/dom.js and open a pull request!

Related References