djk12587 / DJKFlipper

Flipboard like animation library
MIT License
51 stars 13 forks source link

How to make this flip vertically like the transition in flipboard app? #1

Closed monynith closed 9 years ago

monynith commented 9 years ago

I cannot find where to make this changes. Can you point out where can I do this? Thanks.

djk12587 commented 9 years ago

Hi!

I think it is best to understand how it is currently working before trying to change anything. Below is an overview to how the current implementation works. Let me know if that explanation is confusing. http://stackoverflow.com/a/26266025

To Switch it to a vertical flip the animation layer's frame would need to be adjusted to encompass the bottom half of the screen instead of the right half of the screen. The screenshots frame would also need to be adjusted.

This would be done in DJKAnimationLayer and modifying the frontLayer and backLayer property closures. You are also going to need to modify the setTheFrontLayer and setTheBackLayer functions. I also believe in the updateFlipDirection method the self.transform will need to change the 1 for the y vector to the x vector like so "self.transform = CATransform3DMakeRotation(CGFloat(0), 1, 0, 0);"

The staticLayer's left side and right side will also need to be adjusted to top and bottom. The screenshots applied to the top and bottom of the static layer would also need to be adjusted.

This would be done in DJKStaticView and modifying the leftSide and rightSide property closures. You are also going to need to modify the setTheRightSide and setTheLeftSide functions.

You will also need to modify the CATransform3DRotate(t, animationLayer.flipProperties.currentAngle, 0, 1, 0) call within the performFlipWithDJKAnimationLayer method. I think that you need to change the 1 to the X vector instead of the Y vector.

I also think within the panGesture that the progress and translation values might need to be changed instead of expecting a horizontal swipe you will be giving it a vertical swipe.

Also, anything that is relying on an x axis will need to be changed.

This library was not built with having a vertical swipe in mind so modifying it might take some time. It was on my todo list to refactor the codebase to allow vertical swipe so I should get around to it in my free time.

monynith commented 9 years ago

Thank for your comment. I will study from your current one. The vertical one is in your todo list. So, hope that I can use yours soon.

ryansoy commented 9 years ago

i try follow what you point for vertical flip but still not work correctly. Can you point more detail?

djk12587 commented 9 years ago

Can you elaborate on where you are having issues?

My description above was a very rough guess as to what would need to be changed. There might be more to it. I still plan on doing the update myself, but I haven't had the time to sit down and make the changes myself. :(

ryansoy commented 9 years ago

Yes i will waiting for update flip vertical. :)