         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
     }

    /// radius, and lineWidth.
    private func circlePath() -> UIBezierPath {
        let topAngle: CGFloat = CGFloat(-M_PI_2)
        let endAngle: CGFloat = CGFloat(2 * M_PI - M_PI_2)
        let path = UIBezierPath(arcCenter: circleCenter(), radius: circleRadius(), startAngle: topAngle, endAngle: endAngle, clockwise: true)
        
        return path

@IBDesignable
class CustomProgressView: UIView {
    
    /// This property specifies the maximum number of rotations that the view
    /// supports
    @IBInspectable var numberRotations: CGFloat = 10.0 {
        didSet {
            arcLayer.path = circlePath().CGPath
        }
    }
    
    
    /// 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.
