CABasicAnimation不在CAShapeLayer上生成动画

核心动画文档似乎很简单,但我无法弄清楚缺少的东西。 我有一个CAShapeLayer,我想用简单的CABasicAnimation进行动画制作。

我像这样构建CAShapeLayer:

{
 CGRect rect = CGRectMake(focal.x, focal.y, (self.radius * 2), (self.radius * 2));

 self.touchCircle = [CAShapeLayer layer];
 [self.touchCircle setPath:[[UIBezierPath bezierPathWithOvalInRect:rect] CGPath]];
 [self.touchCircle setFrame:rect];
 [self.touchCircle setLineWidth:self.stroke];
 [self.touchCircle setPosition:focal];

 [self focalColorOfPoint:focal];

 [self.layer addSublayer:self.touchCircle];
}

并尝试一个动画:

CABasicAnimation *radiusScale = [CABasicAnimation animationWithKeyPath:@"size"];

[radiusScale setFromValue:[NSValue valueWithCGSize:CGSizeMake(self.mRadius, self.mRadius)]];
[radiusScale setToValue:[NSValue valueWithCGSize:CGSizeMake(self.radius, self.radius)]];
[radiusScale setDuration:0.3f];

[self.touchCircle addAnimation:radiusScale forKey:@"touchCircleRadiusScaleUp"];

有什么建议么? 提前致谢!


尝试使用animationWithKeyPath:@“transform”和动画

.toValue=[NSValue valueWithCATransform3D:CATransform3DMakeScale(scaleX, scaleY, scaleZ)];
链接地址: http://www.djcxy.com/p/74257.html

上一篇: CABasicAnimation not animating on CAShapeLayer

下一篇: CAReplicatorLayer with CAShapeLayer