Slider component » Setting the value of the slider
Setting the value of the slider
Simply setting a different value
will move the knob instantly, while passing a number to animateToValue()
will smoothly animate the knob to the new position.
# setting a new value
slider1.value = .5
# animating to a new value
slider2.animateToValue .5
As an optional second argument, you can add animation options.
# using a custom animation
slider3.animateToValue .5, curve: "spring(1000,10)"