且构网

分享程序员开发的那些事...
且构网 - 分享程序员编程开发的那些事

CAShapeLayer路径动画-缩小圆圈

更新时间:2022-12-30 09:40:08

我最近遇到了同样的问题,最终通过创建圆解决了问题,然后为CGAffineTransform缩放了动画。在以圆为图层的视图中,我只是使用了

I recently had the same question and ended up solving it by creating the circle, then animating the scale CGAffineTransform. In the view whose layer is the circle, I simply used

CGAffineTransform transform = CGAffineTransformIdentity;
transform = CGAffineTransformScale(transform, scaleX, scaleY);

[UIView animateWithDuration: 0.5 animations: ^{
    self.transform = transform;
}];

希望这会有所帮助!