small medium large xlarge

15 Feb 2009, 00:13
Michael Hanna (2 posts)

In the code AnimationTypes/GroupAnimation/GroupAnimationView.m

I changed the keyDown: method from:

` - (void)keyDown:(NSEvent *)event {

[[mover animator] setFrameRotation:[mover frameRotation]]; } ` 


` - (void)keyDown:(NSEvent *)event {

[[mover animator] setFrame:[mover frame]]; } ` 

and I changed line 59-60 from: ` [NSDictionary dictionaryWithObjectsAndKeys: [self groupAnimation:moverFrame], @”frameRotation”, nil]; ` to: ` [NSDictionary dictionaryWithObjectsAndKeys: [self groupAnimation:moverFrame], @”frame”, nil]; `

The CAAnimationGroup attached to mover contains a CAKeyframeAnimation that adjusts the animationAtKeyPath:@”frame”.

So why didn’t the animation start in my modified code? I thought that an animation will start if a property that is associated with the animation is modified?


15 Feb 2009, 12:59
Bill Dudney (916 posts)

Hi Michael,

The ‘frame’ property is actually a special case. Instead of it being a normal property that does valueForKey: against the animation dictionary it is broken into two parts, the frameOrigin and the frameSize. If on lines 59-60 you use frameSize or frameOrigin you will get the group animation to fire.

Hope this helps!

15 Feb 2009, 18:54
Michael Hanna (2 posts)

OK thanks Bill … I’ll take a look at that!


You must be logged in to comment