Re: CALayer Transitions
Re: CALayer Transitions
- Subject: Re: CALayer Transitions
- From: Matt Neuburg <email@hidden>
- Date: Mon, 16 Nov 2009 11:01:25 -0800
- Thread-topic: CALayer Transitions
On Mon, 16 Nov 2009 10:25:07 -0800, Kyle Sluder <email@hidden>
said:
>On Mon, Nov 16, 2009 at 9:23 AM, Matt Neuburg <email@hidden> wrote:
>> On Sun, 15 Nov 2009 22:38:04 -0600, Gordon Apple <email@hidden> said:
>>> What I don't understand, is that, according to the core animation guide,
>>>kCATransition seems to be what I want for a key instead of "sublayers". The
>>>guide says this is triggered by "replaceSublayer: with:". However, stepping
>>>it through, I never see this key come through the delegate.
>>
>> You seem to be imagining that you can call addAnimation:forKey: and then the
>> animation will just lurk there, waiting for something called the "key" to
>> come along, and then the animation will trigger. That is not what
>> addAnimation:forKey: does, and it isn't what the "key" means.
>
>No, I believe now he is talking about the delegate method
>-actionForLayer:forKey:, and wondering why he never gets a key of
>kCATransition, instead getting one for @"sublayers". This runs
>contrary to the documentation.
Nothing here "runs contrary to the documentation." We're now talking apples
and oranges. The "key" used in addAnimation:forKey: (such as kCATransition)
has nothing whatever to do with the "key" that arrives in
actionForLayer:forKey:. They both happen to be called "key" but that's all.
The former, as I explained in my previous message, is just an arbitrary
name, which is used just in case you need to call removeAnimationForKey:
later, and for no other purpose. The latter is the name of a CALayer
animatable property; that property is changing, and you are now being asked
whether to animate that property.
It is a pity that Apple has used the word "key" (and, by implication,
keyPath) in such a fast-and-loose way all over the place. If
addAnimation:forKey: were called addAnimation:withArbitraryName:, and
actionForLayer:forKey: were called actionForLayer:forAnimatableProperty:, we
wouldn't be having this problem now. :)
If you want to complain about the documentation, the thing to complain about
is that it's so hard to discover what the keys are for
actionForLayer:forKey:. Well, yes, there is a list of the keys under
"Animatable Properties" in the Core Animation Programming Guide; but nothing
tells you that replaceSublayer:with: corresponds to the "sublayers"
animatable property key.
m.
--
matt neuburg, phd = email@hidden, <http://www.tidbits.com/matt/>
A fool + a tool + an autorelease pool = cool!
AppleScript: the Definitive Guide - Second Edition!
http://www.tidbits.com/matt/default.html#applescriptthings
_______________________________________________
Cocoa-dev mailing list (email@hidden)
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:
This email sent to email@hidden