pub static createSlider: CreateSliderInternalTypeExpand description
Creates a slider input element in the DOM. Use .size() to set the display length of the slider.
Examples
let slider;
function setup() {
slider = createSlider(0, 255, 100);
slider.position(10, 10);
slider.style('width', '80px');
}
function draw() {
let val = slider.value();
background(val);
}let slider;
function setup() {
colorMode(HSB);
slider = createSlider(0, 360, 60, 40);
slider.position(10, 10);
slider.style('width', '80px');
}
function draw() {
let val = slider.value();
background(val, 100, 100, 1);
}Parameters
min minimum value of the slider
max maximum value of the slider
value? default value of the slider
step? step size for each tick of the slider (if step is set to 0, the slider will move continuously from the minimum to the maximum value)