Re: Core Animation - Animation Sequence
Re: Core Animation - Animation Sequence
- Subject: Re: Core Animation - Animation Sequence
- From: David Duncan <email@hidden>
- Date: Tue, 1 Jun 2010 10:08:23 -0700
On May 31, 2010, at 11:51 PM, Tino Rachui wrote:
> I'm interested in this too so please excuse me for interfering. What is the root cause for Rodolfo's problem? He doesn't seem to set 'removedOnCompletion' to 'NO' (default is 'YES' according to docu) so I'm wondering if this could cause the unwanted effect (by the way I cannot see the bad effect when I try the example in the simulator though).
> David I'm sure I miss the point but how does your proposed solution solve the problem? I'd really like to better understand.
The basic problem is the difference between the model and the render trees. When you add an animation it only affects the render tree. So for example if you ever queried the layer for the values you set, you would get back the original value, not the animated value.
A common workaround for the issue that Rodolfo originally expressed is what you mention, using fillMode=Forward and removedOnCompletion=NO, but the problem there is that you have all of these attached animations that either stick around forever, or that you have to manually remove. These properties are provided for a reason, but in the general case they are unnecessary.
> P.S. David, are you using 'kCAValueFundtionRotateZ' intentionally or is this a typo, same for CATransform3DMakeRotation(...)?
Typed into mail for the most part, so any typos are inadvertent :).
On Jun 1, 2010, at 5:01 AM, Rodolfo Niborski wrote:
> Neither I did figure out how to use David's code. I thought that overriding the implicit animation implies the use of layer actions.
The technique I outlined is best described as a temporary override of an implicit animation.
> I can't see how [layer addAnimation:rotation forKey:@"transform"]; can change the implicit animation.
When an implied animation is generated, it creates an animation with a key that is the key as what was set. That is, if you do this:
layer.opacity = 0.0;
NSLog(@"%@", [layer animationForKey:@"opacity"]);
Then you will find an animation has been attached, so if you do this:
layer.opacity = 0.0;
[layer addAnimation:myAnimation forKey:@"opacity"];
Then you will find that 'myAnimation' replaces the previously added animation.
> Besides, most of my attempts resulted in a EXC_BAD_ACCESS crash, and the rest were not successful.
Not sure what happened, but QA1620 <http://developer.apple.com/mac/library/qa/qa2008/qa1620.html> was recently updated to show this technique.
--
David Duncan
Apple DTS Animation and Printing
_______________________________________________
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