diff --git a/RSKImageCropper/RSKImageCropViewController.m b/RSKImageCropper/RSKImageCropViewController.m index 8cf8922..fa640a3 100644 --- a/RSKImageCropper/RSKImageCropViewController.m +++ b/RSKImageCropper/RSKImageCropViewController.m @@ -577,10 +577,14 @@ - (void)setMaskPath:(UIBezierPath *)maskPath [clipPath appendPath:maskPath]; clipPath.usesEvenOddFillRule = YES; - CABasicAnimation *pathAnimation = [CABasicAnimation animationWithKeyPath:@"path"]; - pathAnimation.duration = [CATransaction animationDuration]; - pathAnimation.timingFunction = [CATransaction animationTimingFunction]; - [self.maskLayer addAnimation:pathAnimation forKey:@"path"]; + CAAnimation *animation = (CAAnimation *)[self.overlayView actionForLayer:self.overlayView.layer forKey:@"backgroundColor"]; + if ([animation isKindOfClass:[CAAnimation class]]) { + CABasicAnimation *pathAnimation = [CABasicAnimation animationWithKeyPath:@"path"]; + pathAnimation.duration = animation.duration; + pathAnimation.timingFunction = animation.timingFunction; + + [self.maskLayer addAnimation:pathAnimation forKey:@"path"]; + } self.maskLayer.path = [clipPath CGPath]; }