      Next function used by animation(). Increments progress based on the duration.
      */
     @objc private func next() {
-        progress += 1/(self.duration*60)
-        if progress >= 1.0 {
-            progress = 1.0
+        let direction: CGFloat = (targetProgress > progress) ? 1.0 : -1.0
+        progress += 1/(self.duration*60)*direction
+        if (direction > 0 && progress >= targetProgress) || (direction < 0 && progress <= targetProgress) {
+            progress = targetProgress
             stop()
         }
     }

    //MARK: Animation
    
    /**
     Animates between from and to value with a given duration.
     
     - parameter duration: Duration in seconds. CGFloat.
     */
    public func animate(duration: CGFloat) {
        self.duration = duration
        displayLink?.invalidate()
        displayLink = CADisplayLink(target: self, selector: #selector(next))

    private var diffVectors = [CGFloat]()
    private let function: InterpolationFunction
    private var internalProgress: CGFloat = 0.0
    private var targetProgress: CGFloat = 0.0
    private var apply: (Interpolatable -> ())
    private var displayLink: CADisplayLink?
    
