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 (Cocoa-dev@lists.apple.com)

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:
http://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com

This email sent to [EMAIL PROTECTED]

Reply via email to