Skip to content

Commit

Permalink
[RSKImageCropper] [RSKImageCropViewController] [setMaskPath:] Synchro…
Browse files Browse the repository at this point in the history
…nize the animation of `maskLayer.path` with the animation of other UI elements.
  • Loading branch information
ruslanskorb committed Apr 6, 2024
1 parent 46421ec commit e0054d2
Showing 1 changed file with 8 additions and 4 deletions.
12 changes: 8 additions & 4 deletions RSKImageCropper/RSKImageCropViewController.m
Original file line number Diff line number Diff line change
Expand Up @@ -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];
}
Expand Down

0 comments on commit e0054d2

Please sign in to comment.