core-animation

How to change the frame rate of a core animation instance?

Take CABasicAnimation for example. How do you lower the frame rate (overhead)? Animations run smooth, but my touchesMoved method skips a beat. Want to reduce the animation frame rate so touchesMoved is not skipping movements. ...

how do you copy an CALayer?

How to you make an NSArray full of multiple instances of a CALayer (all with the same frame, contents etc)? Background: CALayer takes a bit of overhead to create, so I would like to create a number of CALayers (all sharing the same properties) in the init method of a class (to be used later on in that class.) ...

How should I do multiple animations on the iPhone?

I'd like to animate multiple pieces for a game and i'd like to have those pieces move in different directions so my current method of animating an entire view will no longer work. I'm wondering what is the best practice for animating multiple items at once. (Note i'm rendering in 2d so i'm not currently interested in 3d soltuions.) Th...

Is it possible to play a path backwards in a CAKeyFrameAnimation?

I want to animate the position of a CALayer based on a CGPath, but I want to play it backwards. Is there any way to animate a path backwards, or reverse a CGPath? ...

Ugly looking text when drawing NSAttributedString in CGContext

Hello, I want to display strings inside CoreAnimation layers, but unfortunately CATextLayer is not enough, mostly because it's difficult to use when using constraints and you want to wrap the text. I am using NSLayoutManager, using the following code (PyObjC): NSGraphicsContext.saveGraphicsState() # THIS SOLVES THIS ISSUE CGContextSe...

What is CGAffineTransformMakeRotation(RADIAN) exactly doing?

I don't really understand what this function is good for. Can someone explain that (maybe with some examples)? Can I rotate an UIImageView object with this one? ...

How do you override UIView's +(id)layer; class method?

I read in the documentation that a UIView's 'layer' property is read only and that you must override UIView's + (id)layer; class method to access the layer's styling properties. Are there any examples of overriding this method to return a layer/view with styling properties already applied? ...

Is there a way to swap layers or views in the middle of a CAKeyframeAnimation?

I am running a keyFrame animation to move and flip a playing card view using CAKeyframeAnimation. is there any way to swap the cardFront and cardBack layers during the animation? or am i taking the wrong approach here... ...

How can I switch Content Views with an water-effect transition?

In the Photos app, there is a nice water drop effect used for transition. I had seen an app a while ago that used this same water effect transition for it's content views. Unfortunately, this transition type is not listed in the UIViewAnimationTransition documentation. But since this third party app used it (I don't remember it's name)...

How can I add Core Animation framework to my Xcode project?

I just can't find that framework for adding it. Any ideas? ...

What are Layers good for? What could I do with adding an Layer, and why should I think about Layers?

I am wondering what makes Layers different from Views, when every View comes along with it's own Layer. Maybe I am wrong with that. But then: What are these Layers good for? Like I understand it, I would use an UIView to group elements in my GUI. I could also use that UIView to position things over other things. So where come Layers int...

Are most games on the IPhone done with OpenGL ES?

I was just wondering if most games on the iPhone are done in OpenGL ES as opposed to using Quartz and Core Animation. Are Quartz and Core Animation mostly used for just creating slick interfaces? Or if there is a point with games where OpenGL probably has to be used over using other tools? ...

How do you optimize UIColor on the iPhone?

I'm creating a simple color picker controlled by a custom slider type control. I'm passing a float value from my slider to a UIColor constructor method and updating the background color of a CALayer as the value changes. It runs really smooth in the simulator, but I get a lot of flickering when running on the device. Is this just bec...

Graphics, UIKit, Core Animation, Quartz, Core Graphics on the iPhone. SO confusing!

My problem is this: I have a simple block image that I want to make a grid out of. I have created an array of CGPoints in my UIView. Then I used blackImage = [UIImage imageNamed:@"black.png"]; and then - (void)drawRect:(CGRect)rect { for (int j = 0 ; j <= 11; j++) { for (int i = 0 ; i <= 7; i++) { [blac...

CALayer and CGGradientRef anti-aliasing?

Hello all. I'm having an odd issue with CALayer drawing for the iPhone. I have a root layer which adds a bunch of sublayers representing "bubbles". The end result is supposed to look something like this: The problem is that I can't seem to get the layer to anti-alias (notice the jaggies on the bubbles). My code overwriting drawInC...

How do I get the visibleRect Rectangle out of an UIImageView?

Actually that should work, but it doesnt: CALayer *myLayer = [myUIImageView layer]; CGRect visRect = [myLayer visibleRect]; I get an "invalid initializer" error, although my view is loaded definitely since in the next few lines I obtain the frame from the view and move the view around. But under no circumstances I can obtain that visi...

Core Animation... cyclic animations?

To phrase my question as simply as possible, is there a way to create a core animation sequence to repeat over and over until a stop? Specifically, I'm making a custom class that I want to have a -start and -stop method that will cause it to pulsate. Writing the animation code for the pulse is not the problem, rather, how to make it rep...

Cocoa, Flicker with animation when overlaying a NSWindow on a QTMovieView

In a project that I am currently working on I have an transparent NSWindow overlayed on a QTMovieView. At certain points I slide a custom view into this child window with animation so that it is displayed over the movie for a short period of time. The only odd behavior is that the animation is smooth on a Mac Book Pro but on a Mac Book(S...

Can you add a property at run-time when coding with Objective-C

I was wondering if it is possible at run-time to dynamically add new properties to an Objective-C object instance? My initial thought would just to overrride the getValueForKey to "fake" a property but it seems like this doesn't work with CoreAnimation. What I want to achieve is to be able to animate custom properties. I have been able...

CATransaction Not Animating

I've created a new View-based Application in XCode. In the ViewController, the only code that I've modified looks like this: - (void)viewDidLoad { [super viewDidLoad]; UIView *newView = [[UIView alloc] initWithFrame:CGRectMake(0, 0, 200, 200)]; newView.backgroundColor = [UIColor redColor]; [self.view addSubview:newView]; [CATransact...