Re: problems with CAAnimation
Re: problems with CAAnimation
- Subject: Re: problems with CAAnimation
- From: Matt Long <email@hidden>
- Date: Thu, 19 Mar 2009 11:01:14 -0600
Ok. You've just raised the bar! ;-) Seems that you would have to
specify the key path you're wanting for each animation which leads me
to think you won't be able to use grouping as you envision as
setAnimations on the CAAnimationGroup only takes an array rather than
a dictionary in which you could specify keypaths.
In all likelihood you'll have to use - (CAAnimation *)animationForKey:
(NSString *)key in a derived layer. Then you can specify the animation
you want for all keys you're interested in.
In answer to your last question, yes you will need to set the values
of all of the properties you're looking to animate, but if you create
a derived layer as I suggested and override animationForKey, whenever
those keypaths are changed, it will use the animation you've specified
so all you'll have to do is call setValue:forKeyPath on the derived
layer and it will use the correct animation. Does that make sense?
-Matt
On Mar 19, 2009, at 9:47 AM, Memo Akten wrote:
Hi Matt, thanks for the answer and yes you are right on both fronts:
- if I use fillMode and removeOnCompletion then it is visibly
sticky, BUT when I apply another animation (e.g. shrinkAnimation
which scales To:1, without setting a From value) then it snaps
straight back to 1, probably because internally the scale is still
1. If I set the From value for my shrinkAnimation, then it works,
BUT if I quickly trigger grow followed by shrink, it first snaps
upto the full hover scale, and then animates down - which makes
sense given the code, but is not the desired behaviour. Ideally both
my grow and shrink animations should not have a From value, as I
want them to simply animate To a specific target from where it was
at the time of animation being triggered
- Manually setting rootLayer setValue: forKeyPeth:@"transform.scale"
does work perfectly. However this was a simplified example, and
actually I have quite a few CAAnimationGroups, each with about 4-5
CABasicAnimations (scale, position, rotation, alpha etc.). So do I
really have to set the To Value for every property manually before
adding an animation group? And what key should I give the animation
group when adding?
Cheers,
Memo.
_______________________________________________
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