Re: stop pause and resume CAAnimation
Re: stop pause and resume CAAnimation
- Subject: Re: stop pause and resume CAAnimation
- From: Bill Dudney <email@hidden>
- Date: Tue, 4 Dec 2007 12:41:56 -0700
Hi Kevin,
I've not done this but i would approach it like this;
1) keep your destination rect around in an ivar or whatever
2) in the pause: method get the animating view's current position and
tell the animator to to set that as the new position and remove the
animations
3) in the resume: method create a new set of animations and apply them
and tell the animator setFrame with the destination rect
You should be able to ignore the 'fromValue' property, it should
assume the current position if you don't set it.
HTH,
-bd-
http://bill.dudney.net/roller/objc
On Dec 4, 2007, at 9:39 AM, Kevin Barnes wrote:
Hi everyone,
I'm trying to use the animator proxy to modify the size and position
of a view, but I want to be able to set the start, end and duration
of the animation. I have got this working by using the following code:
NSDictionary *nsdict = [widget animations];
CABasicAnimation *originAnim = [CABasicAnimation
animationWithKeyPath:@"frameOrigin"];
CABasicAnimation *sizeAnim = [CABasicAnimation
animationWithKeyPath:@"frameSize"];
[dict setValue:sizeAnim forKey:@"frameSize"];
[dict setValue:originAnim forKey:@"frameOrigin"];
originAnim.fromValue= NSValue valueWithPoint:NSMakePoint(300, 300)];
originAnim.toValue = [NSValue valueWithPoint:NSMakePoint(50, 30)];
sizeAnim.fromValue= [NSValue valueWithSize:NSMakeSize(100, 30)];
sizeAnim.toValue = [NSValue valueWithSize:NSMakeSize(350, 30)];
originAnim.duration = 5.0f;
sizeAnim.duration = 5.0f;
NSRect frameRect = NSMakeRect(50, 30, 350, 30);
[[widget animator] setFrame:frameRect];
My problem is that I would like to be able to stop, pause and resume
the animation before it has finished. I haven't found a way to do
this yet. Has anyone solved this problem, or have any suggestions?
Kevin
_________________________________________________________________
Introducing the City @ Live! Take a tour!
http://getyourliveid.ca/?icid=LIVEIDENCA006_______________________________________________
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
_______________________________________________
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