         let ba = CABasicAnimation(keyPath: "strokeEnd")
         ba.fromValue = fromStroke
         ba.toValue = toStroke
-        ba.duration = arcRotationDuration(fromStroke, toStroke: toStroke)
-        ba.beginTime = arcBeginTime(fromStroke, toStroke: toStroke, fromAngle: fromAngle, toAngle: toAngle)
+        ba.duration = angleRotationDuration(fromAngle, toAngle: toAngle)
+        ba.beginTime = CACurrentMediaTime() + animationDelay
         ba.cumulative = false
         ba.removedOnCompletion = true
         ba.fillMode = kCAFillModeBackwards
+        ba.timingFunction = CAMediaTimingFunction(name: kCAMediaTimingFunctionEaseInEaseOut)
 
         return ba
     }

@IBDesignable
class CustomProgressView: UIView {
    
    /// The amount of progress to show.  A complete rotation is indicated with a 1.
    /// Progress is not limited to values between 0 and 1.  Each complete rotation
    /// is an addition 1 added on.  Progress can not go below zero.

    /// - return: The CFTimeInterval to be used for the animation
    private func angleRotationDuration(fromAngle: CGFloat, toAngle: CGFloat) -> CFTimeInterval {
        let deltaAngle = abs(toAngle - fromAngle)
        
        // Want to use a full rotation time for changes less then one rotation
        if deltaAngle < CGFloat(M_PI * 2) {
            return CFTimeInterval(rotationDuration)
        } else {
            let numberRotations = deltaAngle / CGFloat(2 * M_PI)
            let time = CGFloat(rotationDuration) * round(numberRotations)
            
            return CFTimeInterval(time)
        }
    }
    
}
