• 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
Looping CAKeyframeAnimation stop in place?
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Looping CAKeyframeAnimation stop in place?


  • Subject: Looping CAKeyframeAnimation stop in place?
  • From: "Eric E. Dolecki" <email@hidden>
  • Date: Fri, 09 Nov 2012 14:53:57 -0500

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

  • Follow-Ups:
    • Re: Looping CAKeyframeAnimation stop in place?
      • From: David Duncan <email@hidden>
  • Prev by Date: iOS 6 built-in view controller save-and-restore disappointing
  • Next by Date: Re: Looping CAKeyframeAnimation stop in place?
  • Previous by thread: Re: iOS 6 built-in view controller save-and-restore disappointing
  • Next by thread: Re: Looping CAKeyframeAnimation stop in place?
  • Index(es):
    • Date
    • Thread