Can't get CABasicAnimation to explicitly animate "frame" property of CALayer
Can't get CABasicAnimation to explicitly animate "frame" property of CALayer
- Subject: Can't get CABasicAnimation to explicitly animate "frame" property of CALayer
- From: "Oleg Krupnov" <email@hidden>
- Date: Sun, 9 Nov 2008 14:04:00 +0200
Using Core Animation, I want to make a layer change its position and
size with animation. So I need to use the "frame" property of CALayer,
which is animatable, according to the documentation.
The implicit animation like this:
[theLayer setFrame:NSRectToCGRect(targetFrame)];
works perfectly, but I want to use the explicit animation, because I
want to use a delegate to be notified when the animation ends.
So here is my code:
CABasicAnimation *theAnimation;
theAnimation=[CABasicAnimation animationWithKeyPath:@"frame"];
theAnimation.toValue=[NSValue valueWithRect:targetFrame];
[theAnimation setDelegate:self];
[theLayer addAnimation:theAnimation forKey:@"animateFrame"];
The problem is that the animation does not occur! The layer stays in
the same place and size...
Interesting that the delegate's animationDidStop:finished: method DOES
get called. Also, if I replace the property to "position", or say
"opacity", the animation occurs just fine.
What the problem might be?
_______________________________________________
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