I am creating the circle fill animation but my circle fill at 80 %, at 50 % it is not at half, is there any way it can be corrected because I am confused
class FillCircleAnimatedView : UIView {
private let shapeLayer = CAShapeLayer()
override init(frame: CGRect) {
super.init(frame: frame)
setUpLayer()
}
required init?(coder aDecoder: NSCoder) {
fatalError("init(coder:) has not been implemented")
}
func setUpLayer() {
shapeLayer.fillColor = UIColor.clear.cgColor
shapeLayer.strokeColor = UIColor.black.cgColor
shapeLayer.lineWidth = frame.width
let startAngle = (-1 * CGFloat.pi) / 2
let endAngle = 2 * CGFloat.pi
shapeLayer.path = UIBezierPath(arcCenter: center, radius: frame.width / 2, startAngle: startAngle, endAngle: endAngle, clockwise: true).cgPath
shapeLayer.strokeEnd = 0
layer.addSublayer(shapeLayer)
}
func fillCircle(with progress: CGFloat) {
shapeLayer.strokeEnd = progress
}
}
at 50%
at 80%


