TestsTested | ✗ |
LangLanguage | Obj-CObjective C |
License | zlib |
ReleasedLast Release | Dec 2014 |
Maintained by Unclaimed.
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):
Comparison between iBooks and this segue class:
GC3DFlipTransitionStyleSegue requires iOS 5.0 and above.
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: pod 'GC3DFlipTransitionStyleSegue'
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.
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:
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.
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.
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.
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;
}
}
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:
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.
Altered source versions must be plainly marked as such, and must not be misrepresented as being the original software.
This notice may not be removed or altered from any source distribution.