• 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
Core Animation - Animation Sequence
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Core Animation - Animation Sequence


  • Subject: Core Animation - Animation Sequence
  • From: Rodolfo Niborski <email@hidden>
  • Date: Mon, 31 May 2010 23:24:04 +0200

Dear list,

I have a CALayer called textLayer which displays some message, for example "Hello". I perform two consecutive animations on it. At the end of the first animation, the text is no more visible. The message then gets updated (to "Good bye", let's say) and the second animation brings the layer back to its initial position.

My problem is that at the end of the first animation, the "Hello" message shows up in its initial position for a fraction of a second.
I've tried to set the fillMode of the first animation to kCAFillModeForwards with no effect.

Here is the code for the setup of the animations and the animationDidStop: delegate call for the first one :

textRotationFirstHalf = [[CABasicAnimation animation] retain];
textRotationFirstHalf.fromValue = [NSNumber numberWithFloat: 0.0];
textRotationFirstHalf.toValue = [NSNumber numberWithFloat: M_PI / 2];
textRotationFirstHalf.keyPath = [NSString stringWithString: @"transform.rotation.x"];
textRotationFirstHalf.timingFunction = [CAMediaTimingFunction functionWithName: kCAMediaTimingFunctionEaseIn];
textRotationFirstHalf.delegate = self;
[textRotationFirstHalf setValue:@"Rotation Continues" forKey:@"What Next"];
textRotationFirstHalf.duration = 0.25;

textRotationSecondHalf = [[CABasicAnimation animation] retain];
textRotationSecondHalf.fromValue = [NSNumber numberWithFloat: M_PI / 2];
textRotationSecondHalf.toValue = [NSNumber numberWithFloat: 0];
textRotationSecondHalf.keyPath = [NSString stringWithString: @"transform.rotation.x"];
textRotationSecondHalf.timingFunction = [CAMediaTimingFunction functionWithName: kCAMediaTimingFunctionEaseOut];
textRotationSecondHalf.duration = 0.25;

-(void)animationDidStop:(CAAnimation *)theAnimation finished:(BOOL)flag
{
  NSString *value = [theAnimation valueForKey: @"What Next"];
  if([value isEqual:@"Rotation Continues"])
  {
    [self updateText];
    [textLayer addAnimation: textRotationSecondHalf forKey: @"End Rotation"];
  }
}

The updateText method just calls [textLayer setNeedsDisplay]  which results in the display of the "Good bye" message, because a state variable has changed meanwhile.

What can I do to recover the smoothness of this animation sequence and get rid of the unwanted frame ?

Thank you for any ideas,

Rodolfo Niborski
http://itunes.com/apps/yiddishforkids1-alefbeys_______________________________________________

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: Core Animation - Animation Sequence
      • From: David Duncan <email@hidden>
  • Prev by Date: Re: dynamic resolution
  • Next by Date: Re: Off Screen bitmap drawing
  • Previous by thread: Re: Managed Object Context Reference
  • Next by thread: Re: Core Animation - Animation Sequence
  • Index(es):
    • Date
    • Thread