私はCAShapeLayarのstrokeColorプロパティをアニメーション化しようとしています。私はドキュメンテーションを見て、それがアニメーション可能なプロパティであると述べられました。このコードは、postion.yをアニメーション化するのには機能しますが、strokeColorはアニメーション化しません。事前にコアアニメーションを使用してStrokeColorをアニメーション化する
lyr.fillColor = [[UIColor clearColor] CGColor];
lyr.lineWidth = 3.8;
lyr.strokeColor = [[UIColor yellowColor] CGColor];
lyr.position = CGPointMake(160, 431);
lyr.anchorPoint = CGPointMake(.5f, .5f);
[self.view.layer addSublayer:lyr];
CABasicAnimation *basicAnimation = [CABasicAnimation animationWithKeyPath:@"strokeColor"];
basicAnimation.fromValue = [lyr valueForKey:@"strokeColor"];
basicAnimation.toValue =[NSValue valueWithPointer:[[UIColor clearColor] CGColor]];
basicAnimation.duration = 2;
basicAnimation.repeatCount = 10;
basicAnimation.autoreverses = YES;
[lyr addAnimation:basicAnimation forKey:@"strokeColor"];
おかげで、 または:私は助けやアドバイス
私が使用したコードのいずれかの種類を取得させていただきます。これは動作するはず
も "fillColor"で動作します。 – nh32rg