-
-
Notifications
You must be signed in to change notification settings - Fork 279
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
How to animate slider to value? #9
Comments
Indeed, it be would be the perfect addition |
+1 |
With this function, you can make a CircularSlider instance run 360°. |
add a listener |
@i-am-chris Do you mind sharing some code? Thanks |
Did anyone manage to get the animation of endpoint to work? |
Not a very good approach, but works for me
|
you can also use the func below, the same concept: @objc private func animateProgress(_ progressBar: CircularSlider,from fromValue: CGFloat, to toValue: CGFloat){
let numberOfSteps = 30
let duration = 0.5
let stepValue = (toValue - fromValue) / CGFloat(numberOfSteps)
let delay = duration / Double(numberOfSteps)
func setEndPointValue(_ progressBar: CircularSlider, to value: CGFloat, delay: Double = 0) {
DispatchQueue.main.asyncAfter(deadline: .now() + delay) {
progressBar.endPointValue = value
}
}
for step in 0...numberOfSteps {
setEndPointValue(progressBar, to: fromValue + stepValue * CGFloat(step), delay: delay * Double(step))
}
} |
I was just wondering if there is a way to animate (without user interaction) the slider to a specific value?
The text was updated successfully, but these errors were encountered: