0

I need to animate the color of CATextLayer, and the animation itself works:

CAKeyframeAnimation *animation = [CAKeyframeAnimation animationWithKeyPath:@"foregroundColor"];
animation.duration = 1.0f;
animation.values = @[(id)([UIColor redColor].CGColor), (id)([UIColor blueColor].CGColor)];
[textLayer addAnimation:animation forKey:@"animation"];

However if I want to control the progress of animation by setting the layer's speed to 0, it doesn't work:

animation.speed = 0;
...
textLayer.timeOffset = 0.5f;

Is there anything I missed?

Thanks!

Heuristic
  • 5,087
  • 9
  • 54
  • 94
  • 1
    I think this property may only animatable for macOS 10.6 and later.As the [Doc](https://developer.apple.com/reference/quartzcore/catextlayer/1515305-foregroundcolor) said. – Guan Mar 27 '17 at 06:27
  • @Guan Thanks! I saw that but mis-understood it, I thought the limitation is on macOS but not on iOS, now I read it again and got it. – Heuristic Mar 27 '17 at 23:23
  • @Guan The docs say "Implicit animation"... So does this mean that other platforms require 'Explicit animation', or won't work at all? – Linasses Feb 10 '18 at 18:54

0 Answers0