我正在画一个UIBezierPath
我UIScrollView
已经制作了一个动画,它绘制了从起点到终点的路径,但这不是我想要的动画。
UIBezierPath *linePath = [UIBezierPath bezierPath];
[linePath moveToPoint:startPoints];
[linePath addLineToPoint:endPoints;
//shape layer for the line
CAShapeLayer *line = [CAShapeLayer layer];
line.path = [linePath CGPath];
// line.fillColor = [[UIColor blackColor] CGColor];
line.strokeColor = [[colors objectAtIndex:i] CGColor];
line.lineWidth = 5;
// line.contents = (id)[[UIImage imageNamed:@"Mask.png"] CGImage];
// line.contentsGravity = kCAGravityCenter;
CABasicAnimation *pathAnimation = [CABasicAnimation animationWithKeyPath:@"strokeEnd"];
pathAnimation.duration = 3.0;
pathAnimation.fromValue = @(0.0f);
pathAnimation.toValue = @(1.0f);
pathAnimation.repeatCount = HUGE_VAL;
[line addAnimation:pathAnimation forKey:@"strokeEnd"];
我曾尝试向contents
形状图层添加一个,但我不擅长动画。我想要实现的效果是与“滑动解锁”具有相同的动画,或者是一个脉冲的路径。
我试图做与滑动解锁答案相同的事情,但似乎无法管理