All Projects → eschao → Android Pageflip

eschao / Android Pageflip

Licence: apache-2.0
3D Style Page Flip on Android

Programming Languages

java
68154 projects - #9 most used programming language
GLSL
2045 projects

Projects that are alternatives of or similar to Android Pageflip

android-PageFlip-JNI
JNI library of Page Flip
Stars: ✭ 14 (-99.16%)
Mutual labels:  opengl-es, reading-program, flip-animating
Unitedplayer
A video and audio recorder and player based on OpenGL es,FFmpeg,OpenSl es,MediaCodec on Android platform.It gives video interesting effect through fragment shader.一个支持录制和播放音频视频的安卓短视频应用,并可以选择多种仿抖音滤镜特效展示。
Stars: ✭ 75 (-95.5%)
Mutual labels:  opengl-es
Kepler3d
OpenGL and C++14 game engine that loads glTF 2.0
Stars: ✭ 9 (-99.46%)
Mutual labels:  opengl-es
Indielib Crossplatform
IndieLib is a cross-platform Game Graphics engine. Main focus is OpenGL ES 2.0 for mobile iOS operating system, and OpenGL desktop. **NOT SUPPORTED ANYMORE**
Stars: ✭ 64 (-96.16%)
Mutual labels:  opengl-es
Shapesinopengles2.0
Create basic shapes in opnegles2. And for abstraction purpose, its a class implementation using VBO's to create basic shapes in Open GLES2.0
Stars: ✭ 20 (-98.8%)
Mutual labels:  opengl-es
Magnum Plugins
Plugins for the Magnum C++11/C++14 graphics engine
Stars: ✭ 66 (-96.04%)
Mutual labels:  opengl-es
Android 3d Model Viewer
Android OpenGL 2.0 application to view 3D models. Published on Play Store
Stars: ✭ 809 (-51.5%)
Mutual labels:  opengl-es
Kimera
Low-latency hardware accelerated codec based video streaming utility.
Stars: ✭ 113 (-93.23%)
Mutual labels:  opengl-es
Ogles gpgpu
GPGPU for mobile devices and embedded systems using OpenGL ES 2.0
Stars: ✭ 74 (-95.56%)
Mutual labels:  opengl-es
Q3lite
Q3lite, an OpenGL ES port of Quake III Arena for embedded Linux systems.
Stars: ✭ 64 (-96.16%)
Mutual labels:  opengl-es
Cocoaopengl Swift
A simple example of using Swift to create an OpenGL application for macOS, iOS, and tvOS.
Stars: ✭ 60 (-96.4%)
Mutual labels:  opengl-es
Glfw
A multi-platform library for OpenGL, OpenGL ES, Vulkan, window and input
Stars: ✭ 8,416 (+404.56%)
Mutual labels:  opengl-es
Pharaohstroy
A maplestory IDE which can develop the multi-platform maplestory game
Stars: ✭ 69 (-95.86%)
Mutual labels:  opengl-es
Librestreaming
Android real-time effect filter rtmp streaming library.using Mediacodec HWencoding&librtmp stream.
Stars: ✭ 856 (-48.68%)
Mutual labels:  opengl-es
Gifcompressor
An Android tool to compresses your GIFs into lightweight MP4 video using fast, hardware-accelerated encoders. Supports cropping, rotation, GIF concatenation and much more.
Stars: ✭ 85 (-94.9%)
Mutual labels:  opengl-es
Ios tips
iOS的一些示例,持续更新中:1、AVFoundation 高仿微信相机拍摄和编辑 2、AVFoundation 人脸检测、实时滤镜、音视频编解码、GPUImage框架的使用等音视频相关内容 3、OpenGLES 4、LeetCode算法练习 5、iOS Crash防护和APM监控 6、WKWebView相关的内容 等........
Stars: ✭ 896 (-46.28%)
Mutual labels:  opengl-es
Learningvideo
【Android 音视频开发打怪升级】系列文章示例代码(A demo to introduce how to develop android video)。本项目将从MediaCodec硬解,FFmpeg软解,OpenGL等方面,全方位讲解如何在Android上进行音视频编辑开发。
Stars: ✭ 1,069 (-35.91%)
Mutual labels:  opengl-es
Shaderconductor
ShaderConductor is a tool designed for cross-compiling HLSL to other shading languages
Stars: ✭ 1,146 (-31.29%)
Mutual labels:  opengl-es
Xl player
A high performance Android media player, base on ffmpeg and MediaCodec, support VR video.
Stars: ✭ 126 (-92.45%)
Mutual labels:  opengl-es
Gdx Vfx
LibGDX post-processing visual effects
Stars: ✭ 105 (-93.71%)
Mutual labels:  opengl-es

Android Arsenal

PageFlip

This project is aimed to implement 3D style page flip on Android system based on OpenGL 2.0.

For JNI version, please visit: android-PageFlip-JNI

Table of Contents

Preview

SinglePage DoublePages

Installation

Gradle

Add it to your build.gradle with:

allprojects {
    repositories {
        maven { url "https://jitpack.io" }
    }
}

and:

dependencies {
    compile 'com.github.eschao:android-PageFlip:1.0.2'
}

Android Version Support

The following versions have been tested on emulator:

Android version API version Support
3.2 API 13 x
4.1 API 16
4.2 API 17
4.3 API 18
4.4 API 19
5.0 API 21
5.1 API 22
6.0 API 23
7.0 API 24
7.1.1 API 25
7.+ API 26

Usage

I. Simple steps for introducing PageFlip into your project

  • Creates a surface view class extending from GLSurfaceView

  • Implements android Renderer interface to draw your content on a bitmap and set it as a texture of PageFlip

  • Instanitiates a PageFlip object in the constructor of your surface view

  • Configures PageFlip, For example: set animating duration, page mode or mesh pixels

  • Handles the below android events:

    • onFingerDown: notify PageFlip object to prepare flip
    • onFingerMove: notify PageFlip object to compute data for drawing flip frame
    • onFingerUp: notify PageFlip object to determine whether or not launching a flip animation
    • onSurfaceCreated: notify PageFlip object to handle usreface creating event
    • onSurfaceChanged: notify PageFlip object to handle surface changing event
  • You may need a message handler to send/receive an drawing message. Please refer to PageFlipView in sample application.

  • You may need a lock to avoid conflicts between main thread and OpenGL rendering thread. Please refer to PageFlipView in sample application.

More details, please take a look PageFlipView in sample application.

II. Configure PageFlip

PageFlip library provides some configurations for customizing its behaviors. For example: shadow color and alpha, mesh pixels and page mode.

1. Page Mode

There are two page modes provided by PageFlip:

  • Auto Page Mode: In this mode, PageFlip will automatically decide to use single page or double pages to present content on screen. That means single page is used for portrait mode and double pages is used for lanscape mode.
  • Single Page Mode: No matter screen is portait or landscape mode, PageFlip always use single page to show content

You can use enableAutoPage to enable auto page mode or disable it(equally enable single page mode).

Example:

  // enable auto page mode
  mPageFlip.enableAutopage(true); 

2. Click screen to flip

You can enable/disable clicking screen to flip

Example:

  // enable clicking to flip
  mPageFlip.enableClickToFlip(true);

3. Area of clicking to flip

You can give a ratio of page width from 0 to 0.5f to set an area for reponsing click event to trigger a page flip. The default value is 0.5f, which means the backfward flip will happen if you click the left half of screen and forward flip will start if you click the right half of screen in single page mode.

Example:

  // set ratio with 0.3
  mPageFlip.setWidthRatioOfClickToFlip(0.3f);

4. PageFlip listener

You can set a listener to tell PageFlip if the forward flip or backward flip could happen.

Example:

  mPageFlip.setListener(mListener);

5. Mesh pixels

Set how many pixels are used for a mesh. The less pxiels the mesh uses, the more fine the drawing is and the lower the performance is. The default value is 10 pixels.

Example:

  mPageFlip.setPixelsOfMesh(5);

6. Ratio of semi-peremeter

When page is curled, it is actually tackled as a semi-cylinder by PageFlip. You can set size of the semi-cylinder to change the flip shap. Since the semi-cylinder dependeds on the line length from the touch point to original point(see the below illustration), you need to provide a ratio of this line length to tell PageFlip the peremeter of the semi-cylinder. The default value is 0.8f.

  +----------------+
  |   touchP       |
  |       .        | 
  |        \       |
  |         + p0   |
  |          \     |
  |           \    |
  |        p1  +   |
  |              \ |
  +----------------+
              original point, that means you drag the page from here to touch point(touchP)

  The length from p0 to p1 is peremeter of semi-cylinder and determined by ratio your giving

Example:

  mPageFlip.setSemiPerimeterRatio(0.6f);

7. Mask alpha for the back of fold page

You can set the mask alpha for the back of fold page when page is curled in single page mode. The default value is 0.6f.

Example:

  mPageFlip.setMaskAlphaOfFold(0.5f);

8. Edge shadow color/alpha of fold page

You can set start/end color and start/end alpha for edge shadow of fold page.

Example:

  // set start color with 0.1f, start alpha with 0.2f, end color with 0.5f
  // and end alpha with 1f
  mPageFlip.setShadowColorOfFoldBase(0.1f, 0.2f, 0.5f, 1f);

9. Base shadow color/alpha of fold page

You can set start/end color and start/end alpha for base shadow of fold page.

Example:

  mPageFlip.setShadowColorOfFoldBase(0.05f, 0.2f, 0.5f, 1f);

10. Edge shadow width of fold page

When page is curled, the size of fold page will follow the finger movement to be changed and its edge shadow width should be changed accordingly. You can set an appropriate width range for shadow width.

Example:

  // set the minimal width is 5 pixels and maximum width is 40 pixels.
  // set the ratio is 0.3f which means the width will be firstly computed by formula: 
  // width = diameter of semi-cylinder * 0.3f, and then compare it with minimal
  // and maximal value to make sure the width is in range.
  mPageFlip.setShadowWidthOfFoldEdges(5, 40, 0.3f);

11. Base shadow width of fold page

Like Edge shadow width of fold page, You can set an appropriate width range for base shadow of fold page.

Example:

  // see {@link #setShadowWidthOfFoldEdges} function
  mPageFlip.setShadowWidthOfFoldBase(5, 40, 0.4f);

12. Duration of flip animating

You can give a duration for flip animating when you call onFingerUp function to handle the finger up event.

Example:

  // the last parameter is duration with millisecond unit, here we set it with 2 seconds.
  mPageFlip.onFingerUp(x, y, 2000);

License

This project is licensed under the Apache License Version 2.0.

Note that the project description data, including the texts, logos, images, and/or trademarks, for each open source project belongs to its rightful owner. If you wish to add or remove any projects, please contact us at [email protected].