UISlider to change TimeInterval

  1. 2 years ago
    Edited last year by niutech

    Hi, can you help a newbie please!

    I've created an animation from numerous images & a slider to generate values between 0.00 and 1.00 (both the animation and slider are working fine).

    I would like to use the slider values to change the interval time between each image, thereby varying the speed of the animation.

    But I can't figure out how to substitute the interval time (shown below currently as 0.01) with the slider value.

    Here is the relevant code:

        @IBOutlet var slider: UISlider!
        
        @IBAction func speedChanged(sender: AnyObject)
    
            timer = NSTimer.scheduledTimerWithTimeInterval(0.01, target: self, selector: Selector("doAnimation"), userInfo: nil, repeats: true)

or Sign Up to reply!