Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How do I implement the type of page curl used in Google Play Books?

I've been searching for a proper way to emulate the kind of page flipping/curling used in the iOS apps but in an Android app. The closest thing I have seen on Android is the Google Play Books app. Are they using some part of the SDK that I haven't seen? Is there any chance of getting my hands on a similar implementation?

Most of the examples I have seen are built using some sort of RenderView based on OpenGL. That would probably work, but I would have to make sure that the screen is not rendered in vain, since I don't want to use too much power. Also I'm a little afraid of using OpenGL when handling textures that are not pow2.

Best regards, Kalle

like image 826
KalleStropp Avatar asked Aug 19 '13 08:08

KalleStropp


1 Answers

You have to use OpenGl for making such effect in Android and have to use the below common sinusoidal graph equation :-

y=Asin(2π/λ*x)

Where,

A = Amplitude (i.e. the elevation of curl we want).

λ = Wavelength (i.e. the length of the curl we want).

x = The X axis variable which will change as you move the page.

You have to draw 3 pages on SurfaceView namely 'LeftPage' , 'CenterPage' and 'RightPage', 'CenterPage' is always visible and is responsible for 'right curl' animation while 'LeftPage' is responsible for 'left curl' animation and 'RightPage' just stay static. For detecting gestures use default GestureDetector class.

You can download the sample from here.

like image 77
Karan Kalsi Avatar answered Oct 05 '22 23:10

Karan Kalsi