• Open Menu Close Menu
  • Apple
  • Shopping Bag
  • Apple
  • Mac
  • iPad
  • iPhone
  • Watch
  • TV
  • Music
  • Support
  • Search apple.com
  • Shopping Bag

Lists

Open Menu Close Menu
  • Terms and Conditions
  • Lists hosted on this site
  • Email the Postmaster
  • Tips for posting to public mailing lists
Can't get CABasicAnimation to explicitly animate "frame" property of CALayer
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

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

  • Follow-Ups:
    • Re: Can't get CABasicAnimation to explicitly animate "frame" property of CALayer
      • From: David Duncan <email@hidden>
  • Prev by Date: Re: IKFilterUIView uiConfiguration values - huh?
  • Next by Date: Re: runModalSession in Cocoa plugin for Carbon app does not return
  • Previous by thread: Re: runModalSession in Cocoa plugin for Carbon app does not return
  • Next by thread: Re: Can't get CABasicAnimation to explicitly animate "frame" property of CALayer
  • Index(es):
    • Date
    • Thread