Я рисую 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
к слою формы, но у меня плохо с анимацией. Эффект, которого я хочу добиться, - это та же анимация, что и у «слайда, чтобы разблокировать», или путь, который пульсирует.
Я пытался сделать то же самое, что и ответ из slide-to-unlock но не могу справиться