createSlider()

Creates a HTML Slider element

Example

def setup():
  global slider1,slider2,slider3
  slider1 = createSlider(0, 255,1)
  slider1.position(50,40)
  slider2 = createSlider(0,255,1)
  slider2.position(50,60)
  slider3 = createSlider(0,255,1)
  slider3.position(50,80)
  
def draw():
  global slider1,slider2,slider3
  fill(slider1.value(),slider2.value(),slider3.value())
  circle(200,200,200)

Syntax

createSlider(minimum, maximum, [initial_value], [step])
InputDescription

minimum

minimum value of the slider

maximum

maximum value of the slider

initial_value(optional)

initial value of the slider

step(optional)

step size between values on the slider.

Description

createSlider() function can be used to create a slider control . A slider control is a graphical user interface element that allows the user to select a value within a specified range by dragging a handle along a track.

To draw the slider control on the canvas, you can use the draw() function and the value() method of the slider object

Find these documents helpful? Let the people who made them help your child learn to code at Strivemath!

We'd love to hear your Feedback/Comments here.

Last updated