         
         let rotationAnimation: CAAnimation = {
             let animation = CABasicAnimation(keyPath: "transform.rotation.z")
-            animation.fromValue = 0
-            animation.toValue = M_PI * 2
-            animation.duration = 4
+            animation.fromValue = startAngle
+            animation.toValue = Float.pi * 2
+            animation.duration = 2
             animation.repeatCount = MAXFLOAT
             return animation
         }()

 
    }
    
    
 


}


        shapeLayer.strokeColor = UIColor.red.cgColor
        //you can change the line width
        shapeLayer.lineWidth = 2.0
        //shapeLayer.backgroundColor = UIColor.lightGray.cgColor
        let shapeWidth = CGFloat(60)
        let shapeHeight = CGFloat(60)
        
        let theFrame = CGRect(x: (self.view.frame.size.width/2) - (circleRadius/2), y: (self.view.frame.size.height/2) - (circleRadius/2), width: circleRadius, height: circleRadius)
        
        
        shapeLayer.frame = theFrame
        
        //let screenCenter = CGRect(x: self.view.bounds.size.width/2, y: self.view.bounds.size.height/2, width: 100, height: 100)
        shapeLayer.bounds = shapeLayer.frame
        shapeLayer.backgroundColor = UIColor.lightGray.cgColor
        //shapeLayer.bounds = CGRect(x: self.view.frame.size.width/2, y: self.view.frame.size.height/2, width: (shapeLayer.path?.boundingBoxOfPath.width)!, height: (shapeLayer.path?.boundingBoxOfPath.height)!)
        self.view.layer.addSublayer(shapeLayer)
//
        
        /*
        let rotateAnimation = CABasicAnimation(keyPath: "transform.rotation.z")
