• 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
How to pause and resume an animation that uses a transform (CATransform3DMakeScale)?
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

How to pause and resume an animation that uses a transform (CATransform3DMakeScale)?


  • Subject: How to pause and resume an animation that uses a transform (CATransform3DMakeScale)?
  • From: John Fox <email@hidden>
  • Date: Thu, 21 Aug 2008 17:54:44 +0200

Hello:

I'm trying to pause, and then resume an animation that uses a CATransform3D to set animate the zoom level of a layer. I want to be able to pause the animation, but I can't figure out how to determine the current scale factor of the layer at the time when the animation is paused (using removeAllAnimations on the layer).

Here's how I'm creating the animation in question:

CATransform3D myTransform = CATransform3DMakeScale(aScaleFactor, aScaleFactor, 1.0f);
CABasicAnimation *myTransformAnimation;

myTransformAnimation = [CABasicAnimation animationWithKeyPath:@"transform"];
myTransformAnimation.toValue = [NSValue valueWithCATransform3D:myTransform];

CABasicAnimation *myAnchorPointAnimation;

myAnchorPointAnimation = [CABasicAnimation animationWithKeyPath:@"anchorPoint"];
myAnchorPointAnimation.toValue = [NSValue valueWithPoint:NSMakePoint(. 5, .5)];


CAAnimationGroup *group = [CAAnimationGroup animation];

group.animations = [NSArray arrayWithObjects:myAnchorPointAnimation, myTransformAnimation, nil];


group.duration = aDuration;
group.repeatCount = 0;
group.timingFunction = [CAMediaTimingFunction functionWithName:kCAMediaTimingFunctionEaseInEaseOut];
group.fillMode = kCAFillModeForwards;
group.removedOnCompletion = NO;


What I've tried so far is to look at at the layer's transform property, then getting the appropriate value from the CATransform3D struct. However, from what I can see by logging one of the struct's value (specifically m11), what you get are the values that make up the toValue in my animation, not the current value at the point in time in the animation when the pause happens.

The only other discussion on pausing an animation came from this thread:

http://www.cocoabuilder.com/archive/message/cocoa/2007/12/4/194458

...and it didn't quite apply. If someone has any guidance, I'd really appreciate it.

Best,

John
_______________________________________________

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: How to pause and resume an animation that uses a transform (CATransform3DMakeScale)?
      • From: Bill Dudney <email@hidden>
  • Prev by Date: Re: Obtaining rotation from CTM
  • Next by Date: Re: Obtaining rotation from CTM
  • Previous by thread: 10.4+ NSNumberFormatter in IB3 question
  • Next by thread: Re: How to pause and resume an animation that uses a transform (CATransform3DMakeScale)?
  • Index(es):
    • Date
    • Thread