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

前端 未结 1 872
清歌不尽
清歌不尽 2021-01-02 15:27

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 th

相关标签:
1条回答
  • 2021-01-02 15:53

    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.

    0 讨论(0)
提交回复
热议问题