title: Draw CAShapeLayer strokeEnd circle one side
body: <blockquote>
    <p>I have implemented a basic line drawing animation for a progress bar.The line has a round cap edge.When I moving the slider the line drawing the ending of line is having a rounded cap but in the starting its a square. below is the code I am using am i missing anything?? </p>
  </blockquote>
  
  <p><strong>Image Attached:</strong> expected output</p>
  
  <p><a href="https://i.stack.imgur.com/FW6PE.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/FW6PE.png" alt="expected output"></a></p>
  
  <blockquote>
    <p>Below Code I tried</p>
  </blockquote>
  
  <pre><code>@interface ViewController ()
  {
  
  CGPoint center;
  CGFloat radius;
  
  }
  
   @end
  
  @implementation ViewController
  
  - (void)viewDidLoad {
  [super viewDidLoad];
  center = CGPointMake(200.0, 200.0);
  self.view.layer.backgroundColor = [[UIColor grayColor] CGColor];
  
  
   }
  - (IBAction)greenSlider:(UISlider *)sender {
  [self.view.layer addSublayer:[self drawArcAtCenter:center startAngle:sender.minimumValue endAngle:sender.value radius:100.0 withColor:[UIColor greenColor]]];
   }
   - (IBAction)blueSlider:(UISlider *)sender {
  int value = (int)sender.value;
  if (value &gt; 360) {
      value = value % 90;
  }
  [self.view.layer addSublayer:[self drawArcAtCenter:center startAngle:sender.minimumValue endAngle:(float)value radius:100 withColor:[UIColor blueColor]]];
  }
  
  
  - (CAShapeLayer *) drawArcAtCenter:(CGPoint)newCenter startAngle:(CGFloat)sAngle endAngle:(CGFloat)bAngle radius:(CGFloat) radious withColor:(UIColor*) color
  {
  CGFloat begAngle = sAngle * 3.1459 / 180.0;
  CGFloat endAngle = bAngle * 3.1459 / 180.0;
  
  
  CAShapeLayer *layer = [CAShapeLayer layer];
  
  UIBezierPath *path = [UIBezierPath bezierPath];
  [path addArcWithCenter:newCenter radius:radious startAngle:begAngle endAngle:endAngle clockwise:YES];
  
  
  layer.path = [path CGPath];
  layer.strokeColor = [color CGColor];
  layer.fillColor = [[UIColor clearColor] CGColor];;
  layer.lineWidth = 50.0;
  layer.strokeEnd = 50.0f;
  layer.lineCap = kCALineCapRound;
  layer.cornerRadius = 30.0f;
  
  return layer;
   }
  </code></pre>
  
  <p><a href="https://i.stack.imgur.com/k89N1.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/k89N1.png" alt="coming output"></a></p>