Re: Looping CAKeyframeAnimation stop in place?
Re: Looping CAKeyframeAnimation stop in place?
- Subject: Re: Looping CAKeyframeAnimation stop in place?
- From: "Eric E. Dolecki" <email@hidden>
- Date: Fri, 09 Nov 2012 16:45:03 -0500
Wow that's awesome. Thanks for that :)
Google Voice: (508) 656-0622
Twitter: eric_dolecki XBoxLive: edolecki PSN: eric_dolecki
http://blog.ericd.net
On Fri, Nov 9, 2012 at 4:30 PM, David Duncan <email@hidden> wrote:
> This is probably the simplest way to do it:
> http://developer.apple.com/library/mac/#qa/qa1673/_index.html
>
> On Nov 9, 2012, at 11:53 AM, Eric E. Dolecki <email@hidden> wrote:
>
> > I have a UIImageView that I spin forever (think a top-down view of a
> spool
> > in a tape cassette). However I would like to stop the rotation animation
> &
> > when it does NOT reset the UIImageView to it's original starting
> position.
> >
> > I have this to start it:
> >
> > CAKeyframeAnimation *rotationAnimation;
> >
> > rotationAnimation = [CAKeyframeAnimation animationWithKeyPath:@
> > "transform.rotation.z"];
> >
> >
> >
> > rotationAnimation.values = [NSArray arrayWithObjects:
> >
> > [NSNumber numberWithFloat:0.0 * M_PI],
> >
> > [NSNumber numberWithFloat:0.75 * M_PI],
> >
> > [NSNumber numberWithFloat:1.5 * M_PI],
> >
> > [NSNumber numberWithFloat:2.0 * M_PI],
> nil];
> >
> > rotationAnimation.calculationMode = kCAAnimationPaced;
> >
> >
> >
> > rotationAnimation.removedOnCompletion = NO;
> >
> > rotationAnimation.fillMode = kCAFillModeForwards;
> >
> > rotationAnimation.timingFunction = [CAMediaTimingFunction
> > functionWithName:kCAMediaTimingFunctionLinear];
> >
> > rotationAnimation.duration = 5.0;
> >
> > rotationAnimation.repeatCount = INFINITY;
> >
> > CALayer *layer = [leftSpool layer];
> >
> >
> >
> > [layer addAnimation:rotationAnimation forKey:@"rotationAnimation"];
> >
> > And this to stop it:
> >
> > //This is resetting the rotation to 0 - a visible jump
> >
> > [leftSpool.layer removeAnimationForKey:@"rotationAnimation"];
> >
> >
> > I am looking for a way to start it, stop at current angle, and then
> restart
> > at current angle...
> > _______________________________________________
> >
> > 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
>
> --
> David Duncan
>
>
_______________________________________________
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