any other type of value for the fromValue property of CAAnimation?

2008-07-11 Thread Cloud Strife
Hi everyone.After explore the Core Animation for a while, I found that the
fromValue property of CAAnimation was only set to NSNumber in many samples
and tutorials, although the Apple's document says it accepts the id value.

I am wondering whether I could set  this property to NSColor or CGColor
inorder to change the layer color dynamically. For example, If I want to
change a Green layer to a red one from time to time, could anyone give me a
guidance?

Thank you very much for any help.

-- 
Best regards.
___

Cocoa-dev mailing list (Cocoa-dev@lists.apple.com)

Please do not post admin requests or moderator comments to the list.
Contact the moderators at cocoa-dev-admins(at)lists.apple.com

Help/Unsubscribe/Update your Subscription:
http://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com

This email sent to [EMAIL PROTECTED]


Re: any other type of value for the fromValue property of CAAnimation?

2008-07-11 Thread David Duncan

On Jul 11, 2008, at 5:38 AM, Cloud Strife wrote:

I am wondering whether I could set  this property to NSColor or  
CGColor
inorder to change the layer color dynamically. For example, If I  
want to
change a Green layer to a red one from time to time, could anyone  
give me a

guidance?



CGColorRefs are Core Foundatation data types, and therefore analogous  
to NSObject decedents, thus you can typecast a CGColorRef to an id and  
assign it as a fromValue or toValue of a CAAnimation without needing  
to do any kind of conversion. Note however that NSColor and CGColorRef  
are NOT toll-free bridged, therefore it is an error to assign an  
NSColor where a CGColorRef is expected (or vise versa).

--
David Duncan
Apple DTS Animation and Printing
[EMAIL PROTECTED]



___

Cocoa-dev mailing list (Cocoa-dev@lists.apple.com)

Please do not post admin requests or moderator comments to the list.
Contact the moderators at cocoa-dev-admins(at)lists.apple.com

Help/Unsubscribe/Update your Subscription:
http://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com

This email sent to [EMAIL PROTECTED]