Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How can I flip a CALayer with CATransform3D?

Looking for help on how to have a CALayer flip like a UIView using CATransform3D.

I have seen some articles but I'm having a hard time understanding the 4D and 3D coordinates system, model and references. I also read apple's documentation, but I'm not understanding it either.

My goal is to flip a card located within a layer within a view. I know I could use uiview to do the same thing, but i would rather use a calayer

Thanks in advance for your help.

like image 747
Ole Media Avatar asked Nov 06 '22 08:11

Ole Media


1 Answers

Drew McCormack provides code for just such an animation here, based on previous work by Mike Lee. While he bases his flipping around an NSView, the actual animation is performed on a CALayer generated from the contents of the view. The few view-related components of his implementation can be replaced by pure layers in your case.

like image 102
Brad Larson Avatar answered Nov 09 '22 10:11

Brad Larson