前言
上次给大家介绍了iOS利用UIBezierPath + CAAnimation实现路径动画效果的相关内容,今天实现一个根据心跳路径实现一个路径动画,让某一视图沿着路径进行运动.。
效果图如下:
核心代码
1-首先通过 drawRect 绘制心形路径
- (void)drawRect:(CGRect)rect {
// Drawing code
// 初始化UIBezierPath
UIBezierPath *path = [UIBezierPath bezierPath];
// 首先设置一个起始点
CGPoint startPoint = CGPointMake(rect