         
         
         shapeLayer2.fillColor = UIColor.clear.cgColor
-        shapeLayer2.strokeColor = UIColor.black.cgColor
-        shapeLayer2.lineWidth = 2
+        shapeLayer2.strokeColor = self.lineColor
+        shapeLayer2.lineWidth = self.lineWidth
         
         shapeLayer2.frame = CGRect(x: (self.view.frame.size.width/2) - (circleRadius/2), y: (self.view.frame.size.height/2) - (circleRadius/2), width: circleRadius, height: circleRadius)
         shapeLayer2.bounds =  shapeLayer2.frame


class ViewController: UIViewController {
    
    var activityImg1 = UIImageView()
    var activityImg2 = UIImageView()
    var activityImg3 = UIImageView()
    var activityImg4 = UIImageView()

    override func viewDidLoad() {
        super.viewDidLoad()
        // Do any additional setup after loading the view, typically from a nib.//
    }
    
    @IBAction func btnRandomAction(_ sender: Any) {
        
        self.view.layer.sublayers?.forEach { $0.removeFromSuperlayer() }
        self.viewWillAppear(true)
    }
    override func viewWillAppear(_ animated: Bool) {
        super.viewWillAppear(true)
        
        let acivitySize = CGFloat(200)
        
        //--Image Activity 1
        let imgActivity1 = UIImage(named: "img_ic_activity_1")
        let imageViewActivity1 = UIImageView(image: imgActivity1!)
        let imgActivityHeight1 = acivitySize
        imageViewActivity1.frame = CGRect(x: (self.view.frame.size.width/2) - (imgActivityHeight1/2), y: (self.view.frame.size.height/2) - (imgActivityHeight1/2), width: imgActivityHeight1 , height: imgActivityHeight1)
        
        //--Image Activity 2
        let imgActivity2 = UIImage(named: "img_ic_activity_2")
        let imageViewActivity2 = UIImageView(image: imgActivity2!)
        let imgActivityHeight2 = acivitySize - (acivitySize * 0.1)
        imageViewActivity2.frame = CGRect(x: (self.view.frame.size.width/2) - (imgActivityHeight2/2), y: (self.view.frame.size.height/2) - (imgActivityHeight2/2), width: imgActivityHeight2 , height: imgActivityHeight2)
        
        //--Image Activity 3
        let imgActivity3 = UIImage(named: "img_ic_activity_3")
        let imageViewActivity3 = UIImageView(image: imgActivity3!)
        let imgActivityHeight3 = acivitySize - (acivitySize * 0.2)
        imageViewActivity3.frame = CGRect(x: (self.view.frame.size.width/2) - (imgActivityHeight3/2), y: (self.view.frame.size.height/2) - (imgActivityHeight3/2), width: imgActivityHeight3 , height: imgActivityHeight3)
        
        //--Image Activity 3
        let imgActivity4 = UIImage(named: "img_ic_activity_4")
        let imageViewActivity4 = UIImageView(image: imgActivity4!)
        let imgActivityHeight4 = acivitySize - (acivitySize * 0.3)
        imageViewActivity4.frame = CGRect(x: (self.view.frame.size.width/2) - (imgActivityHeight4/2), y: (self.view.frame.size.height/2) - (imgActivityHeight4/2), width: imgActivityHeight4 , height: imgActivityHeight4)
        
        
     
        self.activityImg1 = imageViewActivity1
        self.activityImg2 = imageViewActivity2
        self.activityImg3 = imageViewActivity3
        self.activityImg4 = imageViewActivity4
        
        
//        let centreView = UIView()
//               let centreFrame = CGRect(x: (self.view.frame.size.width/2) - 5, y: (self.view.frame.size.height/2) - 5, width: 10, height: 10)
//centreView.frame = centreFrame
//        centreView.backgroundColor = UIColor.orange
//        self.view.addSubview(centreView)
        
//        view.addSubview(activityImg1)
//        view.addSubview(activityImg2)
//        view.addSubview(activityImg3)
//        view.addSubview(activityImg4)
        
        
        //drawCircle()
        /*
        drawCircle2()
       drawCircle3()
        drawCircle5()
        */
        
        
        //drawCircle4()
        //rep()
        
        //roatateOnce()
        
        let size = CGFloat(200)
        
        
        drawLab(percentage: 0.95, size: size, duration: 5)
       drawLab(percentage: 0.75, size: size * 0.8, duration: 3)
        drawLab1(percentage: 0.2, size: size * 0.6, duration: 3.5)
        drawLab2(percentage: 0.2, size: size * 0.4, duration: 4)
        

        /*
       drawLab(percentage: randomPercentage(), size: size, duration: randomDuration())
        drawLab(percentage: randomPercentage(), size: size * 0.8, duration: randomDuration())
        drawLab(percentage: randomPercentage(), size: size * 0.6, duration: randomDuration())
        drawLab(percentage: randomPercentage(), size: size * 0.4, duration: randomDuration())
        drawLab(percentage: randomPercentage(), size: size * 0.2, duration: randomDuration())
 */
 
        /*
        drawLab(percentage: 0.1, size: size, duration: 5)
        drawLab(percentage: 0.1, size: size, duration: 4)
        drawLab(percentage: 0.1, size: size, duration: 2)
        drawLab(percentage: 0.3, size: size, duration: 2)
        drawLab(percentage: 0.1, size: size, duration: 3)
        */
        
        //drawLab(percentage: 0.8, size: size, duration: 3)
        //drawLabAnti(percentage: 0.2, size: size * 0.9, duration: 3)

    }


        // Dispose of any resources that can be recreated.
    }
    
    
    func drawBackDrop(){
    
    let backDropView = UIView()
        let backDropSize = self.labSize * 2.2
        backDropView.frame = CGRect(x: self.view.frame.size.width/2 - ((backDropSize)/2), y: self.view.frame.size.height/2 - ((backDropSize)/2), width: (backDropSize), height: (backDropSize))
        backDropView.backgroundColor = UIColor(red: 0, green: 0, blue: 0, alpha: 0.2)
        
        backDropView.layer.borderWidth = 1
        backDropView.layer.masksToBounds = false
        backDropView.layer.borderColor = UIColor.lightGray.cgColor
        backDropView.layer.cornerRadius = backDropView.frame.height/2
        backDropView.clipsToBounds = true
        
        
        self.view.addSubview(backDropView)
        
    
    }

    

    func drawLab(percentage: Double, size: CGFloat,  duration: Double){

        let percentCircle = percentage
        let circleCenter = CGPoint(x: self.view.frame.size.width/2, y: self.view.frame.size.height/2)
        let circleRadius = size
        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 = self.lineColor
        shapeLayer.lineWidth = self.lineWidth

        shapeLayer.frame = CGRect(x: (self.view.frame.size.width/2) - (circleRadius/2), y: (self.view.frame.size.height/2) - (circleRadius/2), width: circleRadius, height: circleRadius)
        shapeLayer.bounds =  shapeLayer.frame
