I'm trying to use core animation to highlight a text field as being invalid.
[[my_field animator] setBackgroundColor [NSColor yellowColor]]
Updates the field background color, but does not animate the change. Updating properties such as the position of the field animates properly. I'm assuming this is because background color isn't included in the NSAnimatablePropertyContainer search.
I've also tried creating the animation explicitly, to no avail.
CABasicAnimation *ani;
ani = [CABasicAnimation animationWithKeyPath:@"backgroundColor"];
ani.fromValue = CGColorCreateGenericRGB(1.0,1.0,1.0,1.0);
ani.toValue = CGColorCreateGenericRGB(1.0,0.0,0.0,1.0);
ani.repeatCount = 2;
ani.autoreverses = YES;
ani.duration = 1.0;
[[my_field layer] addAnimation:ani forKey:"backgroundColor"];
Suggestions for accomplishing this?
Merry Christmas:
This will animate the background color of a view using a backed layer. Remember to set wants layer in the init or awake:
While I never managed to figure out how to animate the background color, I was able to create the desired effect by animating a CIFalseColor filter.