diff --git a/CircularProgressControl/CircularProgressView/CircleShapeLayer.m b/CircularProgressControl/CircularProgressView/CircleShapeLayer.m index 22f5b50..3c39486 100644 --- a/CircularProgressControl/CircularProgressView/CircleShapeLayer.m +++ b/CircularProgressControl/CircularProgressView/CircleShapeLayer.m @@ -106,9 +106,12 @@ - (double)calculatePercent:(NSTimeInterval)fromTime toTime:(NSTimeInterval)toTim - (void)startAnimation { + CALayer *presentation = (CALayer*)[self.progressLayer presentationLayer]; + NSValue *prevVal = [presentation valueForKey:@"strokeEnd"]; + CABasicAnimation *pathAnimation = [CABasicAnimation animationWithKeyPath:@"strokeEnd"]; pathAnimation.duration = 1.0; - pathAnimation.fromValue = @(self.initialProgress); + pathAnimation.fromValue = prevVal; pathAnimation.toValue = @(self.percent); pathAnimation.removedOnCompletion = YES;