Giter Site home page Giter Site logo

i5ting / gc3dfliptransitionstylesegue Goto Github PK

View Code? Open in Web Editor NEW

This project forked from glennchiu/gc3dfliptransitionstylesegue

0.0 2.0 0.0 1.72 MB

iBooks-style 3D flip transition animation rendered in OpenGL ES 2.0 and wrapped in a UIStoryboardSegue subclass

gc3dfliptransitionstylesegue's Introduction

GC3DFlipTransitionStyleSegue

iBooks-style 3D flip transition animation rendered in OpenGL ES 2.0 and wrapped in a UIStoryboardSegue subclass.

Segue in action (complete clip can be found on Youtube):

image

Comparison between iBooks and this segue class:

image

Features / Design

  • Uses OpenGL ES rendering instead of Core Animation for high performance (60 fps) and shader effects.
  • Uses GLKit to drastically reduce the amount of OpenGL ES 2.0 code (to write and maintain).
  • Inspired by Apple's 3D flip view controller transition animation, as found in iOS apps like iBooks, iTunes U and Podcasts.
  • Supports different screen sizes and screen orientations.
  • Quick and easy setup. See installation.

Requirements

GC3DFlipTransitionStyleSegue requires iOS 5.0 and above.

Installation

Add the source code to your project (and image file if you want to use it). Link your target against QuartzCore.framework, GLKit.framework and OpenGLES.framework.

CocoaPods support is coming soon.

If you use this class in a non-ARC project, make sure you add the -fobjc-arc compiler flag for the implementation file.

Quick setup: Just set this class as a custom segue and it'll work right away.

image

Customization

To change the default texture on the side, change these macros:

#define IMAGE_NAME  @"wood"
#define IMAGE_TYPE  @"jpg"

Exposed in the header file are some customization properties:

- Depth

This property sets the depth (or thickness) of the 3D object.

@property (assign, nonatomic) float depth

Discussion

Depth value cannot be 0 (zero) as this will set the default value of 0.5 (kGC3DFlipTransitionStyle_iBooks). For a very small depth value use kGC3DFlipTransitionStyle_Horizontal.

There are three constant keys set in the header file:

extern float kGC3DFlipTransitionStyle_Horizontal

Very small depth like Apple's transition style animation UIModalTransitionStyleFlipHorizontal. To see how it looks like, take a look at the screenshot.

extern float kGC3DFlipTransitionStyle_iTunesU

Depth value set like the iTunes U app (bit smaller than iBooks).

extern float kGC3DFlipTransitionStyle_iBooks

Dept value set like the iBooks (and Podcasts) app. This is the default value.

- disableLightEffect

This property disables the light effect.

@property (assign, nonatomic) BOOL disableLightEffect

Discussion

Disabling the light effect allows the animation to mimic Apple's 3D flip transition animation. It does not have an effect on performance. Light effect is enabled by default. To see how it looks like, take a look at the screenshot.

- disableMultisampling

This property disables 4x multisampling anti-aliasing (4x MSAA).

@property (assign, nonatomic) BOOL disableMultisampling

Discussion

Multisampling improves image quality. It is enabled by default. Disable it for slightly better performance on older devices.

Example

This is an example on how to set the segue properties:

- (void)prepareForSegue:(UIStoryboardSegue *)segue sender:(id)sender
{
    if ([segue isKindOfClass:[GC3DFlipTransitionStyleSegue class]])
    {
        GC3DFlipTransitionStyleSegue *flipSegue = (GC3DFlipTransitionStyleSegue *)segue;
        flipSegue.disableLightEffect = YES;
        flipSegue.disableMultisampling = YES;
        flipSegue.depth = kGC3DFlipTransitionStyle_iTunesU;
    }
}

Screenshots:

image

Todo

  • Add option to flip view controllers in opposite direction like Apple's Podcasts app.
  • Improve snapshot performance on the iPad.

License

This code is distributed under the terms and conditions of the zlib license.

Copyright (c) 2013 Glenn Chiu

This software is provided 'as-is', without any express or implied warranty. In no event will the authors be held liable for any damages arising from the use of this software.

Permission is granted to anyone to use this software for any purpose, including commercial applications, and to alter it and redistribute it freely, subject to the following restrictions:

  1. The origin of this software must not be misrepresented; you must not claim that you wrote the original software. If you use this software in a product, an acknowledgment in the product documentation would be appreciated but is not required.

  2. Altered source versions must be plainly marked as such, and must not be misrepresented as being the original software.

  3. This notice may not be removed or altered from any source distribution.

gc3dfliptransitionstylesegue's People

Contributors

glennchiu avatar

Watchers

 avatar  avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.