-
Notifications
You must be signed in to change notification settings - Fork 109
About
HMGLTransitions is set of Objective C classes which can animate few UIKit transitions in iOS ( > 3.0). This is not enhancement of standard animations. This animation works differently. All transitions are presented in UIView with CAEAGLLayer using OpenGL, which gives you absolute freedom in creating almost any animation. You can start using only transitions already created. Right now this four transitions are available: Switch3DTransition
, FlipTransition
, RotateTransition
and ClothTransition
(more comming). To perform transition animation HMGLTransitionManager
singleton object is used.
You can create UIView transition animation in same manner as creating UIKit transition animations, except transition object must be set first.
FlipTransition *transition = [[[FlipTransition alloc] init] autorelease]; // 1
[[HMGLTransitionManager sharedTransitionManager] setTransition:transition]; // 2
[[HMGLTransitionManager sharedTransitionManager] beginTransition:containerView]; // 3
[view1 removeFromSuperview]; // 4
[containerView addSubview:view2]; // 5
[[HMGLTransitionManager sharedTransitionManager] commitTransition]; // 6
- First new transition object is created. You can implement your own object by subclassing HMGLTransition and implementing all of it's methods. Here
FlipTransition
object is used. - Transition object is set
- Transition is initialized with containerView.
-
view1
which should be a subview ofcontainerView
is removed from display hierarchy -
view2
is added as subview ofcontainerView
- animation starts
Presenting and dismissing UIViewController is absolutely straight-forward.
ClothTransition *transition = [[[ClothTransition alloc] init] autorelease]; // 1
[[HMGLTransitionManager sharedTransitionManager] setTransition:transition]; // 2
[[HMGLTransitionManager sharedTransitionManager] presentModalViewController:modalController onViewController:actualController]; // 3
- New transition object is created
- Transition object is set.
- UIViewController is presented.
modalController
is new UIViewController which we want to present andactualController
is UIViewController which is active at the moment (usually it isself
)
The easiest way to create your own transition is start with Switch3DTransition
and rewrite it. (More details soon).