我想为 CAShapeLayer 的 strokeColor 设置动画,但在 CABasicAnimation 中我有两个值(从和到)。动画火了是不是只有两种颜色支持?例如,在开始时我strokeColor = [UIColor blueColor].CGColor;
有
CABasicAnimation *colorAnimation = [CABasicAnimation animationWithKeyPath:@"strokeColor"];
colorAnimation.duration = 3.0; // "animate over 3 seconds or so.."
colorAnimation.repeatCount = 1.0; // Animate only once..
colorAnimation.removedOnCompletion = NO; // Remain stroked after the animation..
colorAnimation.fillMode = kCAFillModeForwards;
colorAnimation.toValue = (id)[UIColor redColor].CGColor;
colorAnimation.timingFunction = [CAMediaTimingFunction functionWithName:kCAMediaTimingFunctionEaseIn];
在中途我有一个深紫色,但我需要,例如,黄色。
是否可以向 CABasicAnimation 添加自定义渐变?