Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Curl from left to right #12

Closed
mgruendler opened this issue Oct 25, 2011 · 4 comments
Closed

Curl from left to right #12

mgruendler opened this issue Oct 25, 2011 · 4 comments

Comments

@mgruendler
Copy link

I have my app set up nicely now and I can flip pages forward (i.e. I can turn pages from right to left). But how can I flip backwards? When I call XBCurlView->curlView and I set the starting point of the cylinder to the left X-coordinate of the screen, the curling takes place from left to right but the visual effect is the same as curling from right to left.

Is there an easy way to curl into another direction?

@xissburg
Copy link
Owner

You have to set the initial cylinder properties before adding the XBCurlView in your view hierarchy. Then, you just have to animate them. To do a flip to the previous page, you can set the cylinder position to (0,0), angle π/2 and radius 0. Then animate it to the other side of the screen, for instance set the cylinder position to (width,0) and angle π/4. For the radius, you could increase it till half the animation duration and then decrease it, like set it to 80 in the middle of the animation and then set it to 20 to the end (use a completion block). Hope this helps.

@mgruendler
Copy link
Author

Hmm, no that is not what I meant to say. You are correct, with your example values the curling takes place from left to right - but it actually simply "uncurls" the curling of the other direction.

What I need to to is, that the edge of the curled view starts to "lift" in the bottom left corner of the page. With Your values the whole page "uncurls" until the edge of the curled view settles in the bottom right corner. Basically I need to mirror the normal curling effect.

I hope I could explain it properly.

@xissburg
Copy link
Owner

Ah, right, now I understand. It's very easy to do that actually. You just
have to rotate the cylinder in the other direction, for instance, set it to
M_PI/2, and move the cylinder from left to right. What happens is that the
view curls after the cylinder, then if you rotate it more the 90 degrees
clockwisely it should start to curl in the other direction.

Hope this helps.
On Oct 26, 2011 8:08 PM, "Marcus Grndler" <
reply@reply.github.com>
wrote:

Hmm, no that is not what I meant to say. You are correct, with your example
values the curling takes place from left to right - but it actually simply
"uncurls" the curling of the other direction.

What I need to to is, that the edge of the curled view starts to "lift" in
the bottom left corner of the page. With Your values the whole page
"uncurls" until the edge of the curled view settles in the bottom right
corner. Basically I need to mirror the normal curling effect.

I hope I could explain it properly.

Reply to this email directly or view it on GitHub:
#12 (comment)

@mgruendler
Copy link
Author

Smile :-)! Okay now I figured it out. After watching my app making some very interesting dancing pirouettes while searching for good start and target angles, I am using these values now which seem to look fine:

self.cylinderAngle = 5_M_PI/3;
CGFloat targetCylinderAngle = 3_M_PI/2;

Many thanks for your hints!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants