core-animation

Does the -presentationLayer tell me the in-flight values of an view while it is beeing animated?

The doc says: presentationLayer Returns a copy of the layer containing all properties as they were at the start of the current transaction, with any active animations applied. And somewhere else Apple said, that the presentation layer contains the values like they are currently displayed to the user. So when I ask for this ...

animate rotation

I'm trying to animate a rotation using CATransform3DMakeRotation, but the problem is once the animation is finished, the image goes back to its initial position, i.e back to zero. But I'd like to keep it where it finished rotating. How would I do that? edit What I'm trying to do is to create the same compass which comes with the new iPh...

Using Core Animation/CALayer for simple layered painting

I would like to create a custom NSView that takes a layered approach to painting. I imagine the majority of the layers would be the same width and height as the backing view. Is it appropriate to use the Core Animation classes like CALayer for this task, even though I don't expect to need much animation? Is there a more appropriate appr...

CALayer delegate method drawLayer not getting called

My object a sub class of NSObject has CALayer instance variable. I use it for drawing and caching content with its delegate set to my object. But for some reason drawLayer:inContext: method NEVER gets called. Whereas actionForLayer:forKey: delegate method does get called implying the delegate is getting set properly with the [layer.de...

Rendering the genie effect to the custom components rendered in the UIView

How to render the genie effect that we see in the MacOS or in iPhone native transitions, in the custom components that are rendered in the UIView? Any links that describe about the screen transition effects? ...

Trying to order built-in UIAnimations, not having much success

OK, I have a screen in my iPhone app that looks like the following: When the Add Notes cell is touched, I would like for the keyboard to disappear, THEN I would like it to modally display the Edit Notes Screen (which also has a keyboard, but I would like for it to animate back on screen). Right now it animates everything at once (the ...

How to use CAGradientLayer?

I'm getting up to speed with the new APIs introduced in OS 3.0, especially the cool new improvements to Core Animation (mostly on CALayer etc...). Now I'm trying to figure out how to use CAGradientLayer. It looks simple at first, but the NSArray it requires for the colors property must contain CGColorRef (according to the header file). I...

change counterclockwise to clockwise with CGAffineTransformIdentity

I have a telephone wheel. On the touchend, it goes to his position with an animation. Until the angle is less than 180°, it returns clockwise. No problem, with this code : - (void)touchesEnded:(NSSet *)touches withEvent:(UIEvent *)event { [UIView setAnimationBeginsFromCurrentState:YES]; [UIView beginAnimations:nil context:NULL]; [U...

How do I use a timing function within an animation on the iPhone?

Hi, I want to use a timing function lets say kCAMediaTimingFunctionEaseInEaseOut My aim is I have start point (X1,Y1) and end point (X2,Y2) and I want a ease function which will provide the easing functionality over this points range. Like varying the (X,Y) range and giving me a curve from start to end. How to do that in iPhone. Like ...

How to identify CAAnimation within the animationDidStop delegate?

I had a problem where I had a series of overlapping CATransition / CAAnimation sequences, all of which I needed to perform custom operations when the animations stopped, but I only wanted one delegate handler for animationDidStop. However, I had a problem, there didn't appear to be a way to uniquely identify each CATransition / CAAnimat...

Core Animation window flip effect

Any tutorials or sample code to get the Core Animation window flip effect? I'm using Flipr right now, which uses Core Image to generate the effect but CoreAnimation is much smoother Thanks ...

UIImageView animation

Hi, I need to animate and imageview, first rotate it in one direction, shift the center and rotate it in the opposite direction in a single animation loop. What i did was :: [UIImageView beginAnimations:nil context:NULL]; [UIImageView setAnimationDuration:2.0]; [UIImageView setAnimationDelegate:self]; [UIImageView setAnimationWillStar...

Autorotation of CALayer on iPhone rotation

I have a UIViewController where I am adding a CALayer subclass to the view's layer: [self.view.layer addSublayer:myObject.backgroundLayer]; When I rotate the device, the view rotates, but the CALayer doesn't. It sort of gets shunted off to the left, still in portrait view. Is there a way to make sublayers rotate automatically or do ...

CAShaperLayer -renderInContext Doesn't Work?

I am able to create a UIImage from a Core Animation layer using the following code: - (UIImage*)contentsImage; { UIGraphicsBeginImageContext([self bounds].size); [self renderInContext:UIGraphicsGetCurrentContext()]; UIImage *image = UIGraphicsGetImageFromCurrentImageContext(); UIGraphicsEndImageContext(); return image; }...

What happens to the view.frame.size attribute after a CGAffineTransform (Rotate)?

I have a UIImageView that can be resized by pinching in and out (Example: view.frame.size.width+10). The image of the Image View can also be rotated (CGAffineTransformMakeRotate). Okay, here is the problem: When I resize the UIImageView AFTER having had applied a Rotate Transform the view resizes abnormally (inversly (shrink when it shou...

How do I draw a point inside of an instance of UIImageView?

How do I use Core Graphics to draw inside of a instantiated UIImageView (No class files to override drawrect with -- just a reference to the instance)? I want to draw a simple point of fixed width (say, 10 pixels diameter) and of a certain color. ...

How to drag, toss, animate a view along a curved path.

I have an view-based iPhone app. Currently there is a small image in the top left hand corner of the screen. When the user taps the screen the image is animated using a CAKeyframeAnimation along a curvy path to the lower right hand corner of the screen. Now I want to change the app so instead of animating on the tap event, the user can ...

What is the relationship between anchor points as set in Interface Builder and for the view's layer?

I'm rotating a view that's placed in Interface Builder using CGAffineTransformMakeRotation, but even though I have the anchor point set to the top left in Interface Builder the rotation still happens around the center of the view. As a crappy work around I am setting the anchor point upon startup and then repositioning the view, i.e.: [...

Drawing woes with CALayer.

First of all, im finding the iPhone online docs to be not-so-very thoroughly clear when it comes to the various ways of rendering a layer. I get the jist of it, but im not clear when to use which methods and which requires the layer to be added as a sub layer or not. My project started off trivially with me loading images and simply dra...

How to cancel an animation for a specific context and animationID?

I have an animation which I kick off like this: [UIView beginAnimations:@"doThis" context:self]; [UIView setAnimationDuration:1.5f]; [UIView setAnimationDelay:2.5f]; Now, the problem is that this animation is told to start in 2.5 seconds. But in the meantime, something may happen and I don't want the animation anymore. However, CA wil...