core-animation

Does a CAKeyframeAnimation pick up the current state when a new CAKeyframeAnimation starts while another is running?

I wonder what would happen. i.e. I kick off a CAKeyframeAnimation, and while it runs I kick off another one on the same keyPath and object. I want it to pick up the current state, but unlike in the nice UIView CA wrapper methods, I don't see a "beginsFromCurrentState" property. So would it pick it up or not? ...

What's the point of kCAAnimationDiscrete and kCAAnimationPaced?

The documentation is very poor on this. What's the effect of these? The only thing that seems to work as expected is kCAAnimationLinear. What can I do with the others, for example? ...

How to let a CAKeyframeAnimation pick up the current state when overriding another?

I have one like this: CALayer *layer = stripeButton.layer; CAKeyframeAnimation *moveAnim = [CAKeyframeAnimation animationWithKeyPath:@"bounds.origin.y"]; moveAnim.duration = 3.35; moveAnim.repeatCount = 0; moveAnim.autoreverses = NO; moveAnim.removedOnCompletion = NO; moveAnim.calculationMode = kCAAnimationLinear; moveAnim.fillMode = kC...

How to Rotate a CALayer-backed NSView subclass

I have a custom NSView subclass that I want to animate with Core Animation. I am already (without CA) setting the position and rotation of these views with NSView's setFrameOrigin and setFrameRotation methods. However, no matter what I do, once I add a layer backing to the views I can't get them to rotate. I've tried using NSView's setF...

Does anyone know a tutorial that teaches you to make a bobblehead?

I'm trying to make a bobble head app, but I don't know how to use the movement technology.. Any thoughts? Thanks ...

CALayer explicit animations not behaving properly.

Implicitly things behave fine. But when i try to use explicit animations to do multiple animations on a single layer (e.g. opacity and translation) I get odd results. First of all, i tried using CATransaction. Then i switched to CAAnimationGroup. Both doesnt seem to get what i want. What do I want? All i want is for a layer to move fro...

Disable redrawing of CALayer contents when moved (iphone)

I have a UIView with a large number of CALayers (~1000), each of which has a small image as its contents. This UIView is a subview of a scrollview (actually it's a subview of another view which is a subview of the scrollview). This draws relatively quickly at first (couple seconds). However when I scroll in the scrollview the frame ra...

Am trying to add an animation to a class that has extended UIView, but it is not adding it at all!!

This is the strangest error i have come across. Am trying to add a countdown animation onto a Class that extends UIView. The code is shown below: NSArray *myImages = [[NSArray alloc] initWithObjects: [UIImage imageNamed:@"3.png"], [UIImage imageNamed:@"2.png"], [UIImage imageNamed:@"1.png"], [UIImage imageNamed:@"Go.png"], nil]; UIIma...

Why does this CALayer not display an image?

Can you guys tell why this code shows no image? CALayer *layerBack = [CALayer layer]; addedObject = [[UIImage alloc]initWithContentsOfFile:[[NSBundle mainBundle] pathForResource:[NSString stringWithFormat: @"%@%d", PREFIX, number] ofType:@"png"]]; layerBack.bounds=CGRectMake(0.0f,0.0f,selectedImage.size.height,selectedImage.size....

smoothly stopping a core animation rotation

How do you stop the rotation of a custom drawn CALayer on the iPhone? This CATransform3D pausetransform = ((CALayer *)[layer presentationLayer]).transform; [layer removeAllAnimations]; layer.transform = pausetransform; stops the animation, then immediately rotates the layer back a little bit. Probably because after the pausetransform...

Blending modes on CALayers on screen? Is that possible?

Is that possible to have a CALayer over another one composed using a blending mode on screen? I now that it is possible to do that offscreen using drawinrect, but is it possible to see it live on the screen? thanks for any help. ...

Any reason to use NSViewAnimation over CoreAnimation techniques?

I'm working on a Snow Leopard app and I'm doing some view animations (swapping them) and I've seen some older examples using NSViewAnimation. I'm wondering if these are completely obsoleted by Core Animation? It seems fairly simple for me to use [[myView animator] setFrame:newSwapFrame]; But I'm just wondering if I'm missing somethin...

How to rotate image in the speedometer?

I am using this code for rotate animation: CABasicAnimation *spinAnimation = [CABasicAnimation animationWithKeyPath:@"transform.rotation.z"]; spinAnimation.fromValue =[NSNumber numberWithFloat:0]; spinAnimation.toValue = [NSNumber numberWithFloat:3.30]; spinAnimation.duration =2; [imgArrow.layer addA...

How to get layer point?

I am using this code to rotate a needle (like in a speedometer): CALayer* layer = someView.layer; CABasicAnimation* animation; animation = [CABasicAnimation animationWithKeyPath:@"transform.rotation.z"]; animation.fromValue = [NSNumber numberWithFloat:0.0 * M_PI]; animation.toValue = [NSNumber numberWithFloat:1.0 * M_PI]; animation.dura...

How to remove animation (CABasicAnimation)?

I want to remove an animation (CABasicAnimation) before it has completed. For example: In my code, I start a needle animating from a rotation value of 0 to a target value of 5. How do I stop the animation when the needle reaches a rotation value of 3? CALayer* layer = someView.layer; CABasicAnimation* animation; animation = [CABasicA...

When to use CALayer on the Mac/iPhone?

I'm slightly confused when to use CALayer on the iPhone or Mac and when not to use it? CoreAnimation works just fine on my UIView based objects without having to use CALayer. When is the appropriate time to dig into this class? ...

Why does the UITableView section header disappear after scrollToRowAtIndexPath animation?

I setup a UITableView which does the following when you tap a section header: Expand the section (inserting rows animated) Scroll to the first item in that section also animated Like this: [self.tableView beginUpdates]; //Expand [self.tableView insertRowsAtIndexPaths:ips withRowAnimation:UITableViewRowAnimationFade]; [self.table...

Optimize fullscreen CALayer animation

Hello all, I've built a very cool looking animation for an end-game state in my (very first) app using CALayers that i'm now looking for a way to speed up - on a 3G iPhone this runs at ~15fps which is ok but on the 3GS it runs at 60fps which looks silky. set-up of the layers/animations below: The 'background' of the app has two layers e...

How do you do an equivalent scaling call in cocos2d as this Core Animation scale?

I'm looking for something that does a similar call, but using cocos2d... the idea is to enlarge the sprite and then fade it out... Here's is a similar call in core animation: [UIView beginAnimations:nil context:nil]; [UIView setAnimationDuration:ANIM_NORMAL]; someView.alpha = 0.0; someView.transform = CGAffineTransformMakeScale (3.0, 3....

Deleting UITableView sections combined with custom section headers UIViews = bug in Apple's code?

I'm trying to delete a section from a UITableView using animation and custom table section header UIViews. I use... //Deletion from my model done here (not shown) and then perform the deleteSections... [self.tableView beginUpdates]; [self.tableView deleteSections:[NSIndexSet indexSetWithIndex:index] withRowAnimation:UITableViewRow...