Re: Resizing NSView with CABasicAnimation
Re: Resizing NSView with CABasicAnimation
- Subject: Re: Resizing NSView with CABasicAnimation
- From: Scott Anguish <email@hidden>
- Date: Wed, 16 Apr 2008 01:01:17 -0400
why use explicit at all?
just work through the animator object and set the new value... if
necessary you can surround it with a transaction ot change the size.
assuming 'self' is the View
[[self animator] setFrame:largerRect];
done.
it'll work with or without layer backing being turned on.
in the below sample at least one problem (aside form it being entirely
unnecessary and that you shouldn't manipulate the layer on a layer-
backed view) is that you are trying to do a progression of rectangles
into a CGSize.
On Apr 15, 2008, at 8:54 PM, Michael Fey wrote:
Folks,
I'm trying to perform a basic resize on an NSView subclass using an
explicit animation. The code compiles and runs without crashing,
but also without performing the resize. I'm obviously missing
something very basic, but I haven't been able to find the answer
elsewhere. Here's my sample code:
CABasicAnimation* resizeAnimation = [CABasicAnimation
animationWithKeyPath:@"frame.size"];
[resizeAnimation setDelegate:self];
resizeAnimation.duration = 3.0;
resizeAnimation.fromValue = [NSValue valueWithRect:[self frame]];
resizeAnimation.toValue = [NSValue valueWithRect:largerRect];
[[self layer] addAnimation:resizeAnimation forKey:@"frame"];
Thanks for any insights.
_______________________________________________
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