• Open Menu Close Menu
  • Apple
  • Shopping Bag
  • Apple
  • Mac
  • iPad
  • iPhone
  • Watch
  • TV
  • Music
  • Support
  • Search apple.com
  • Shopping Bag

Lists

Open Menu Close Menu
  • Terms and Conditions
  • Lists hosted on this site
  • Email the Postmaster
  • Tips for posting to public mailing lists
Page flip effect using Core Animation?
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Page flip effect using Core Animation?


  • Subject: Page flip effect using Core Animation?
  • From: Demitri Muna <email@hidden>
  • Date: Tue, 22 Jul 2008 12:28:27 +0100

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@hidden)

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:
This email sent to email@hidden


  • Prev by Date: Re: Two Questions About Parsing a String
  • Next by Date: Re: [NSString stringWithContentsOfURL:...], threads, and 10.5.4, xcode 3.1
  • Previous by thread: Re: SBApplication error with iTunes 7.7
  • Next by thread: Re: [NSString stringWithContentsOfURL:...], threads, and 10.5.4, xcode 3.1
  • Index(es):
    • Date
    • Thread