Hello,

I'm beginning to delve into Core Animation, and am trying to implement what (I think) should be a very simple effect. I want to rotate a 50x50 layer around an axis defined by one of the edges which is fixed. The best analogy is looking down on a book and turning a page, the edge of the page being fixed in the binding. I have this so far:

CGFloat angle = DegreesToRadians(-180);

CATransform3D transform = CATransform3DIdentity;
layer.anchorPoint = CGPointMake(1.0, 0.5); // turn page to right
transform = CATransform3DRotate(transform, angle, 0, 1, 0); // y-axis rotation
transform = CATransform3DTranslate(transform, -25, 0, 0);
transform.m34 = 0.01f; // for pretty 3D effect
layer.transform = transform;

This is close in that the final and initial states are right, but the translation I added to get that makes the "page" move off the binding in the process. Also, why is the value -25 the right one to move the layer to the right position? I would have thought that it would be -50 (i.e. the width).

Any help greatly appreciated!

Cheers,

Demitri

_______________________________________________

Cocoa-dev mailing list ([email protected])

Please do not post admin requests or moderator comments to the list.
Contact the moderators at cocoa-dev-admins(at)lists.apple.com

Help/Unsubscribe/Update your Subscription:
http://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com

This email sent to [EMAIL PROTECTED]

Reply via email to