How do I create a custom page curl Core Animation?
Asked Answered
C

2

10

I'm trying to create a "page curl" animation of an image in my iPhone application. I t UIViewAnimationTransitionCurlUp, and it's undocumented Core Animation siblings, however the image I need to animate is a transparent PNG, with "uneven" (some alpha pixels) outlines. When using the aforementioned pre-made transition, those alpha pixels are painted black as soon as the animation starts, which looks terribly ugly.

Therefore, I seek to create a Core Animation of my own. I have tried to research the subject, but have been unable to find a good overview of the techniques involved. The implementation would of course have to be more complex than a single property change, I get the feeling that even CATransform3D would be to limited for this purpose, as the image needs to have different 3D transformations applied in different parts of it - changing over time. How would one then go about this subject? I'm very grateful for any thoughts or ideas!

Best, Eli

Cassella answered 28/9, 2009 at 20:2 Comment(3)
Core Animation is an abstraction of OpenGL. So the transitions are actually OpenGL manipulations of the layers. I'm not sure if there is a way for you to define a custom animation in OpenGL and then use it in the CoreAnimation framework. That's what I would research first to see if it possible.Wolfgang
Did you ever find a good solution for this?Lyse
alku83, not really.. Ended up overlaying the screen with an animating UIImageView.Cassella
O
6

As Corey points out, you'll probably need to go with OpenGL ES for this one. Core Animation exposes the ability to work with layers, even in 3-D, but all layers are just rectangles and they are manipulated as such. You can animate the flipping of a layer about an axis, even with a perspective distortion, but the kind of curving you want to do is more complex than you can manage using the Core Animation APIs.

You might be able to split your image up into a mesh of tiny layers and manipulate each using a CATransform3D to create this curving effect, but at that point you might as well be using OpenGL ES to create the same effect.

Oxyhydrogen answered 1/10, 2009 at 2:55 Comment(0)
S
0

The book Core Animation for Mac OS X and the iPhone: Creating Compelling Dynamic User Interfaces from Pragmatic Programmer may help you write custom Core Animation animations.

Sudor answered 28/9, 2009 at 22:39 Comment(1)
In this case, it won't help. The Core Animation book serves as a great introduction to the technology, and describes what you can do with the various layer types and animations provided by the framework, but stops short of the kind of extreme customization he needs.Oxyhydrogen

© 2022 - 2024 — McMap. All rights reserved.