Re: Why does a custom CALayer property work differently from a standard one?
Re: Why does a custom CALayer property work differently from a standard one?
- Subject: Re: Why does a custom CALayer property work differently from a standard one?
- From: Roland King <email@hidden>
- Date: Fri, 26 Oct 2012 08:23:27 +0800
On 26 Oct, 2012, at 5:56 AM, Corbin Dunn <email@hidden> wrote:
>
> Technically, the above code is incorrect. You have to set one of the values, per the header comment.
>
>
> /* The objects defining the property values being interpolated between.
> * All are optional, and no more than two should be non-nil. The object
> * type should match the type of the property being animated (using the
> * standard rules described in CALayer.h). The supported modes of
> * animation are:
> *
> * - both `fromValue' and `toValue' non-nil. Interpolates between
> * `fromValue' and `toValue'.
> *
> * - `fromValue' and `byValue' non-nil. Interpolates between
> * `fromValue' and `fromValue' plus `byValue'.
> *
> * - `byValue' and `toValue' non-nil. Interpolates between `toValue'
> * minus `byValue' and `toValue'.
> *
> * - `fromValue' non-nil. Interpolates between `fromValue' and the
> * current presentation value of the property.
> *
> * - `toValue' non-nil. Interpolates between the layer's current value
> * of the property in the render tree and `toValue'.
> *
> * - `byValue' non-nil. Interpolates between the layer's current value
> * of the property in the render tree and that plus `byValue'. */
>
That's interesting for a couple of reasons. The first line says that all properties are optional. Also, I didn't use the header, I used the documentation which has this extra line in it over and above the ones above
"All properties are nil. Interpolates between the previous value of keyPath in the target layer’s presentation layer and the current value of keyPath in the target layer’s presentation layer."
and was very careful to make sure I used the latest iOS docs not the OSX ones, I've made that mistake before. This is what it actually does for the position property
Finally, were it true, it would make the class of restricted use, you couldn't use setAnimation:forKey with it if you wanted to animate between the previous and current value of a property, which is probably the most usual use case.
OK nobody knows, my OCD has kicked in on this one so I'll burn a DTS incident on it, I might learn something.
_______________________________________________
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