facebookarchive / pop

An extensible iOS and OS X animation library, useful for physics-based interactions.
Other
19.66k stars 2.88k forks source link

Animating view or layer background color? #39

Closed davidolesch closed 10 years ago

davidolesch commented 10 years ago

Trying to animate color is causing crashes for me. I tried both kPOPViewBackgroundColor and kPOPLayerBackgroundColor.

Animating with the kPOPViewBackgroundColor property crashes the app due to uncaught exception 'Unsuported value', reason: 'Animating UICachedDeviceRGBColor values is not supported'.

Animating with the kPOPLayerBackgroundColor property crashes the app due to uncaught exception 'NSInternalInconsistencyException', reason: 'unhandled type 9'.

I'm doing really simple animations like

POPBasicAnimation *colorAnim = [POPBasicAnimation animationWithPropertyNamed:kPOPViewBackgroundColor];
    colorAnim.toValue = [UIColor redColor];
    [someView pop_addAnimation:colorAnim forKey:@"colorAnim"];
nicopasso commented 10 years ago

Use colorAnim.toValue = (__bridge id)([UIColor redColor].CGColor);

kimon commented 10 years ago

Correct. We currently support CGColorRef natively, but UIColor support would be a nice enhancement. Let's use this issue to track.

kimon commented 10 years ago

We now support UIColor and NSColor.

davidolesch commented 10 years ago

Thanks Kimon. I pulled in the new pod and confirmed that UIColor works.

kimon commented 10 years ago

Excellent. Thanks for confirming.