1
我想動畫CAShapeLayer的strokeColor,但在CABasicAnimation中,我有兩個值(from和to)。只有兩種顏色支持,而動畫是火嗎?例如,在開始我strokeColor = [UIColor blueColor].CGColor;
然後如何通過自定義漸變更改strokeColor
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添加自定義漸變?
非常非常感謝您的幫助和快速回答! =) – 2013-05-03 20:36:29
@RostK。顯然,這會帶來很多選擇。用另外兩個例子更新了我的答案。 – Rob 2013-05-03 20:52:15