     
     }
     
-    func drawLab1(percentage: Double, size: CGFloat,  duration: Double){
-        
-        
-        let percentCircle = percentage
+    func drawLab1(size: CGFloat,  duration: Double){
+        
         let circleCenter = CGPoint(x: self.view.frame.size.width/2, y: self.view.frame.size.height/2)
         let circleRadius = size
         let startAngle = CGFloat(0)

        
 
        
         shapeLayer.add(rotationAnimation, forKey: "rotation")
         shapeLayer2.add(rotationAnimation, forKey: "rotation")
         shapeLayer3.add(rotationAnimation, forKey: "rotation")
        shapeLayer4.add(rotationAnimation, forKey: "rotation")
        shapeLayer5.add(rotationAnimation, forKey: "rotation")
        
    }
    
    func drawCircle(){
    
        let percentCircle = 0.1
        let circleCenter = CGPoint(x: self.view.frame.size.width/2, y: self.view.frame.size.height/2)
        let circleRadius = CGFloat(120)
        let startAngle = CGFloat(0)
        let endAngle = CGFloat((M_PI * 2 * percentCircle))
        
        //let circlePath = UIBezierPath(arcCenter: circleCenter, radius: circleRadius, startAngle: startAngle, endAngle:endAngle, clockwise: true)
        //let arcWidth: CGFloat = 76
        
        let circlePath = UIBezierPath(arcCenter: circleCenter, radius: circleRadius, startAngle: startAngle, endAngle: endAngle, clockwise: true)
        
        let shapeLayer = CAShapeLayer()
        shapeLayer.path = circlePath.cgPath
        
        //change the fill color
        shapeLayer.fillColor = UIColor.clear.cgColor
        //you can change the stroke color
        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")
        rotateAnimation.fromValue = 0.0
        rotateAnimation.toValue = CGFloat(M_PI * 2.0)
        rotateAnimation.duration = 1.0
        rotateAnimation.repeatCount = Float.infinity
        shapeLayer.add(rotateAnimation, forKey: nil)
        */
        
       // CATransform3D current = myLayer.transform;
   
        
        let rotationAnimation: CAAnimation = {
            let animation = CABasicAnimation(keyPath: "transform.rotation.z")
            animation.fromValue = startAngle
            animation.toValue = Float.pi * 2
            animation.duration = 2
            animation.repeatCount = MAXFLOAT
            return animation
        }()
        
        shapeLayer.add(rotationAnimation, forKey: "rotation")
        
        /*
         shapeLayer.strokeEnd = (CGFloat(M_PI * 2 * percentCircle))
         // Then apply the animation.
         var drawAnimation = CABasicAnimation(keyPath: "strokeEnd")
         drawAnimation.duration = 1
         drawAnimation.fromValue = Int(startAngle)
         drawAnimation.toValue = Int(endAngle)
        drawAnimation.repeatCount = Float(CGFloat.infinity)
         drawAnimation.timingFunction = CAMediaTimingFunction(name: kCAMediaTimingFunctionEaseInEaseOut)
         shapeLayer.add(drawAnimation, forKey: "drawCircleAnimation")
    */
/*
 
        let spinAnimation = CABasicAnimation(keyPath: "transform.rotation.z")
        //spinAnimation.byValue = 1//Int(2.0 * .pi)
  
        spinAnimation.toValue = M_PI_2
        spinAnimation.duration = 4
        spinAnimation.repeatCount = .infinity
        shapeLayer.add(spinAnimation, forKey: "indeterminateAnimation")
 
 
 */
 
        /*
        UIView.animate(withDuration: 2, delay: 3, options: .curveLinear, animations: {() -> Void in
            var myRotationTransform: CATransform3D = CATransform3DRotate(shapeLayer.transform, (CGFloat(M_PI_2) * 0.85),     //experiment with flatness
                1.0,     // rotate only across the x-axis
                0.0,     // no y-axis transform
                0.0)
            //  no z-axis transform
            shapeLayer.transform = myRotationTransform
        }, completion: nil)
*/
        
        /*
        let start = CGPoint(x: 100, y: 100)
        let middle = CGPoint(x: 450, y: 380)
        let end = CGPoint(x: 200, y: 200)
        
        var path = UIBezierPath()
        path.move(to: start)
       path.addLine(to: middle)
        path.addLine(to: end)
        
        //design path in layer
        var shapeLayerr = CAShapeLayer()
        shapeLayerr.path = path.cgPath
        shapeLayerr.strokeColor = UIColor.orange.cgColor
        shapeLayerr.fillColor = UIColor.blue.cgColor
        shapeLayerr.lineWidth = 3
        
        view.layer.addSublayer(shapeLayerr)
 */
 
    }
    
    func drawCircle2(){
        
        let percentCircle = 0.75
        let circleCenter = CGPoint(x: self.view.frame.size.width/2, y: self.view.frame.size.height/2)
        let circleRadius = CGFloat(120)
        let startAngle = CGFloat(0)
        let endAngle = CGFloat((M_PI * 2 * percentCircle))
        
        let circlePath = UIBezierPath(arcCenter: circleCenter, radius: circleRadius, startAngle: startAngle, endAngle:endAngle, clockwise: true)
        
        
        
        let shapeLayer = CAShapeLayer()
        shapeLayer.path = circlePath.cgPath
        

        shapeLayer.fillColor = UIColor.clear.cgColor
        shapeLayer.strokeColor = UIColor.orange.cgColor
        shapeLayer.lineWidth = 2.0
       // shapeLayer.backgroundColor = UIColor.blue.cgColor
        let shapeWidth = shapeLayer.path!.boundingBoxOfPath.width
        let shapeHeight = shapeLayer.path!.boundingBoxOfPath.height
        shapeLayer.frame = CGRect(x: (self.view.frame.size.width/2) - (shapeWidth/2), y: (self.view.frame.size.height/2) - (shapeHeight)/2, width: shapeLayer.path!.boundingBoxOfPath.width, height: shapeLayer.path!.boundingBoxOfPath.height)
        shapeLayer.bounds = shapeLayer.path!.boundingBoxOfPath
        self.view.layer.addSublayer(shapeLayer)
        
        let rotationAnimation: CAAnimation = {
            let animation = CABasicAnimation(keyPath: "transform.rotation.z")
            animation.fromValue = 0
            animation.toValue = M_PI * 2
            animation.duration = 4
            animation.repeatCount = MAXFLOAT
            return animation
        }()
        
        shapeLayer.add(rotationAnimation, forKey: "rotation")
        
      
    }

    func drawCircle3(){
        
        let percentCircle = 0.85
        let circleCenter = CGPoint(x: self.view.frame.size.width/2, y: self.view.frame.size.height/2)
        let circleRadius = CGFloat(100)
        let startAngle = CGFloat(0)
        let endAngle = CGFloat((M_PI * 2 * percentCircle))
        
        let circlePath = UIBezierPath(arcCenter: circleCenter, radius: circleRadius, startAngle: startAngle, endAngle:endAngle, clockwise: true)
        
        
        
        let shapeLayer = CAShapeLayer()
        shapeLayer.path = circlePath.cgPath
        
        
        shapeLayer.fillColor = UIColor.clear.cgColor
        shapeLayer.strokeColor = UIColor.orange.cgColor
        shapeLayer.lineWidth = 2.0
        // shapeLayer.backgroundColor = UIColor.blue.cgColor
        let shapeWidth = shapeLayer.path!.boundingBoxOfPath.width
        let shapeHeight = shapeLayer.path!.boundingBoxOfPath.height
        shapeLayer.frame = CGRect(x: (self.view.frame.size.width/2) - (shapeWidth/2), y: (self.view.frame.size.height/2) - (shapeHeight)/2, width: shapeLayer.path!.boundingBoxOfPath.width, height: shapeLayer.path!.boundingBoxOfPath.height)
        shapeLayer.bounds = shapeLayer.path!.boundingBoxOfPath
        self.view.layer.addSublayer(shapeLayer)
        
        let rotationAnimation: CAAnimation = {
            let animation = CABasicAnimation(keyPath: "transform.rotation.z")
            animation.fromValue = 0
            animation.toValue = M_PI * 2
            animation.duration = 3
            animation.repeatCount = MAXFLOAT
            return animation
        }()
        
        shapeLayer.add(rotationAnimation, forKey: "rotation")
        
        
    }
    
    func drawCircle4(){
        
        let percentCircle = 0.75
        let circleCenter = CGPoint(x: self.view.frame.size.width/2, y: self.view.frame.size.height/2)
        let circleRadius = CGFloat(150)
        let startAngle = CGFloat(0)
        let endAngle = CGFloat((M_PI * 2 * percentCircle))
        
        let circlePath = UIBezierPath(arcCenter: circleCenter, radius: circleRadius, startAngle: startAngle, endAngle:endAngle, clockwise: true)
        
        
        
        let shapeLayer = CAShapeLayer()
        shapeLayer.path = circlePath.cgPath
        
        
        shapeLayer.fillColor = UIColor.clear.cgColor
        shapeLayer.strokeColor = UIColor.white.cgColor
        shapeLayer.lineWidth = 4
        // shapeLayer.backgroundColor = UIColor.blue.cgColor
        let shapeWidth = shapeLayer.path!.boundingBoxOfPath.width
        let shapeHeight = shapeLayer.path!.boundingBoxOfPath.height
        shapeLayer.frame = CGRect(x: (self.view.frame.size.width/2) - (shapeWidth/2), y: (self.view.frame.size.height/2) - (shapeHeight)/2, width: shapeLayer.path!.boundingBoxOfPath.width, height: shapeLayer.path!.boundingBoxOfPath.height)
        shapeLayer.bounds = shapeLayer.path!.boundingBoxOfPath
        self.view.layer.addSublayer(shapeLayer)
        
        let rotationAnimation: CAAnimation = {
            let animation = CABasicAnimation(keyPath: "transform.rotation.z")
            animation.fromValue = 0
            animation.toValue = M_PI * 2
            animation.duration = 4
            animation.repeatCount = MAXFLOAT
            return animation
        }()
        
        shapeLayer.add(rotationAnimation, forKey: "rotation")
        
        
    }
    
    func drawCircle5(){
        
        let percentCircle = 0.8
        let circleCenter = CGPoint(x: self.view.frame.size.width/2, y: self.view.frame.size.height/2)
        let circleRadius = CGFloat(170)
        let startAngle = CGFloat(0)
        let endAngle = CGFloat((M_PI * 2 * percentCircle))
        
        
        let circlePath = UIBezierPath(arcCenter: circleCenter, radius: circleRadius, startAngle: CGFloat(-M_PI_2), endAngle:CGFloat(M_PI * 2 * percentCircle - M_PI_2), clockwise: true)

       // let circlePath = UIBezierPath(arcCenter: circleCenter, radius: circleRadius, startAngle: startAngle, endAngle:endAngle, clockwise: true)
        
        
        
        let shapeLayer = CAShapeLayer()
        shapeLayer.path = circlePath.cgPath
        
        
        shapeLayer.fillColor = UIColor.clear.cgColor
        shapeLayer.strokeColor = UIColor.blue.cgColor
        shapeLayer.lineWidth = 2
        // shapeLayer.backgroundColor = UIColor.blue.cgColor
        let shapeWidth = shapeLayer.path!.boundingBoxOfPath.width
        let shapeHeight = shapeLayer.path!.boundingBoxOfPath.height
        shapeLayer.frame = CGRect(x: (self.view.frame.size.width/2) - (shapeWidth/2), y: (self.view.frame.size.height/2) - (shapeHeight)/2, width: shapeLayer.path!.boundingBoxOfPath.width, height: shapeLayer.path!.boundingBoxOfPath.height)
        shapeLayer.bounds = shapeLayer.path!.boundingBoxOfPath
        self.view.layer.addSublayer(shapeLayer)
        
        let rotationAnimation: CAAnimation = {
            let animation = CABasicAnimation(keyPath: "transform.rotation.z")
            animation.fromValue = 0
            animation.toValue = M_PI * 2
            animation.duration = 5
            animation.repeatCount = MAXFLOAT
            return animation
        }()
        
        shapeLayer.add(rotationAnimation, forKey: "rotation")
        
        
    }
    
    
    func rep(){
        
        let replicatorLayer = CAReplicatorLayer()
        replicatorLayer.frame = self.view.bounds
        
        // 2
        replicatorLayer.instanceCount = 30
        replicatorLayer.instanceDelay = CFTimeInterval(1 / 30.0)
        replicatorLayer.preservesDepth = false
        replicatorLayer.instanceColor = UIColor.white.cgColor
        
        // 3
        replicatorLayer.instanceRedOffset = 0.0
        replicatorLayer.instanceGreenOffset = -0.5
        replicatorLayer.instanceBlueOffset = -0.5
        replicatorLayer.instanceAlphaOffset = 0.0
        
        // 4
        let angle = Float(M_PI * 2.0) / 70
        replicatorLayer.instanceTransform = CATransform3DMakeRotation(CGFloat(angle * 2), 0.0, 0.0, 1.0)
        self.view.layer.addSublayer(replicatorLayer)
        
        // 5
        let instanceLayer = CALayer()
        let layerWidth: CGFloat = 10.0
        let midX = self.view.bounds.midX - layerWidth / 2.0
        instanceLayer.frame = CGRect(x: midX, y: 0.0, width: layerWidth, height: layerWidth * 3.0)
        instanceLayer.backgroundColor = UIColor.white.cgColor
        replicatorLayer.addSublayer(instanceLayer)
        
        /*
        // 6
        let fadeAnimation = CABasicAnimation(keyPath: "opacity")
        fadeAnimation.fromValue = 1.0
        fadeAnimation.toValue = 0.0
        fadeAnimation.duration = 1
        fadeAnimation.repeatCount = Float(Int.max)
        
        // 7
        instanceLayer.opacity = 0.0
        instanceLayer.add(fadeAnimation, forKey: "FadeAnimation")
    */
    
    }

}


        
    }
    
    func drawLab2(size: CGFloat,  duration: Double){
        
        let circleCenter = CGPoint(x: self.view.frame.size.width/2, y: self.view.frame.size.height/2)
        let circleRadius = size
        let startAngle = CGFloat((Float.pi * 11)/6)
