In the Photos app, there is a nice water drop effect used for transition. I had seen an app a while ago that used this same water effect transition for it's content views.
Unfortunately, this transition type is not listed in the UIViewAnimationTransition documentation. But since this third party app used it (I don't remember it's name), I guess that there is a way of using it.
Does anyone know?
I think it's just a hidden CATransition type:
CATransition *transition = [CATransition animation];
transition.type = #"rippleEffect";
transition.duration = 5.0f;
transition.timingFunction = UIViewAnimationCurveEaseInOut;
[self.layer addAnimation:transition forKey:#"transitionViewAnimation"];
(Note: I haven't tried this for rippleEffect but I have used suckEffect and spewEffect similarly)
It is not part of the published SDK. If you want to sell your app in the app store, you need to implement this yourself.
Related
I want to create an 'unfold' animation to a UIView that appears on the screen.
An example of the animation can be viewed in this YouTube video that reviews the SuperList app (Another example of the animation can be viewed in the app's App Store page in the screenshots section).
I have quite good understanding of Core Animation and Objective C, so as with Cocoa and Cocoa Touch. The app will support versions 5.x and 4.x of iOS so, if it is possible, I would prefer a solution that suits both cases.
Moreover, I have googled this question about a thousand times and failed to get any answers, so help will be much appreciated. Thanks ahead, iLyrical.
Apparently, the 'UnCurl' effect is built-in with the framework and is your to use!
All you have to do, is use the animateWithDuration: animation: method of the UIView class and include the animation as follows:
[UIView animateWithDuration:1.0
animations:^{
CATransition *transition = [CATransition animation];
[transition setDelegate:self];
[transition setDuration:0.7];
[transition setTimingFunction:[CAMediaTimingFunction functionWithName:kCAMediaTimingFunctionEaseIn]];
[transition setType:#"pageUnCurl"];
[self.view.layer addAnimation:transition forKey:#"pageUnCurl"];
[self.view addSubview:someView.view];
}];
The note image (white page) in this case has transparent section (all side) and thus when uncurl happens it looks like only the white part is uncurling.
I have seen lots of people asking on how to push/pop UINavigationControllers using other animations besides the default one, like flip or curl.
The problem is that either the question/answer was relative old, which means the have some things like [UIView beginAnimations:] (example here) or they use two very different approaches.
The first is to use UIView's transitionFromView:toView:duration:options:completion: selector before pushing the controller (with the animation flag set to NO), like the following:
UIViewController *ctrl = [[UIViewController alloc] init];
[UIView transitionFromView:self.view
toView:ctrl.view
duration:1
options:UIViewAnimationOptionTransitionFlipFromTop
completion:nil];
[self.navigationController pushViewController:ctrl animated:NO];
Another one is to use CoreAnimation explicitly with a CATransaction like the following:
// remember you will have to have the QuartzCore framework added to your project for this approach and also add <QuartzCore/QuartzCore.h> to the class this code is used
CATransition* transition = [CATransition animation];
transition.timingFunction = [CAMediaTimingFunction functionWithName:kCAMediaTimingFunctionEaseIn];
transition.duration = 1.0f;
transition.type = #"flip";
transition.subtype = #"fromTop";
[self.navigationController.view.layer removeAllAnimations];
[self.navigationController.view.layer addAnimation:transition forKey:kCATransition];
UIViewController *ctrl = [[UIViewController alloc] init];
[self.navigationController pushViewController:ctrl animated:NO];
There are pros and cons for both approaches.
The first approach gives me a much cleaner code but restricts me from using animations like "suckEffect", "cube" and others.
The second approach feels wrong just by looking at it. It starts by using undocumented transitions types (i.e. not present in the Common transition types documentation from CATransition Class Reference) which might get your app rejected from App Store (I mean might as I could not found any reference of apps being rejected because it was using this transactions, which I would also appreciate any clarification on this matter), but it gives you much more flexibility on your animations, as I can use other animation types such as "cameraIris", "rippleEffect" and so on.
Regarding all that, do I really need to appeal for QuartzCore and CoreAnimation whenever I need a fancier UINavigationController transition? Is there any other way to accomplish the same effect using only UIKit?
If not, will the use of string values like "flip" and "cube" instead of the pre-defined constants (kCATransitionFade, kCATransitionMoveIn, etc...) be an issue regarding my app approval in the App Store?
Also, are there other pros and cons regarding both approaches that could help me deciding whether to choose each one of them?
With regards to the AppStore approval, I don't think its a deal-breaker based on what animation libraries you use. You can use which ever you feel is convenient for you, and can use them together as well. From a personal standpoint, I would say the CoreAnimation & QuartzCore are pretty awesome when you are trying to add animation to a particular event. Its great because of the level of detail you can add to individual components.
But those are not your only options. You should have a look at COCOS2D libraries for animation. They are really awesome and extremely simple to use. For example if using CoreAnimation takes you 30 lines of code, you can use COCOS2D and set it up with 3-5 lines of code. Also, you can integrate Physics with each component when you use the COCOS2D framework (chipmunk).
I know this question was asked here many times before but I am still not sure whether apple will reject the app if I used "pageCurl" and "pageUncurl" animation types.
I found some very old links mentioning their app got rejected but it was before SDK 3.2 and I also come to know that in SDK 3.2 apple allowed this animation.
I think based on research apple might not reject it but I am looking for someone who can confirm this based on facts.
CATransition *animation = [CATransition animation];
[animation setDelegate:self];
[animation setDuration:0.45f];
[animation setTimingFunction:UIViewAnimationCurveEaseInOut];
if (!curled){
animation.type = #"pageCurl";
animation.fillMode = kCAFillModeForwards;
animation.endProgress = 0.58;
} else {
animation.type = #"pageUnCurl";
animation.fillMode = kCAFillModeBackwards;
animation.startProgress = 0.42;
}
[animation setRemovedOnCompletion:NO];
[[mCurlPage layer] addAnimation:animation forKey:#"pageFlipAnimation"];
Thanks
I know this is a pretty old post, but we have actually had an app, in the Store for some months now, which uses this animation.
It seems that Apple might allow it even though it is not officially supported.
after lot of googling I have dropped the plan to use pageCurl and pageUncurl API in my iphone app since there is no app which have this API and is approved in app store. hopefully apple will enable this API in future.
I have implemented camera in iPhone and taking images and save it in PhotoAlbum.
Now what i want is when i save one image and make button enable for taking second image i want iris to be shown in between.So that it feels excatly like Camera functionality of iPhone.
How i do that please give some suggestion.
Thanks
Apps like Stachematic and Zombiematic actually got away with using this private API ...
CATransition *animation = [CATransition animation];
[animation setDelegate:self];
[animation setDuration:0.3];
animation.timingFunction = UIViewAnimationCurveEaseInOut;
[animation setType:#"cameraIris"];
[cameraView.layer addAnimation:animation forKey:nil];
I'm trying to achieve the camera iris animation from the Apple camera app. It is also found in numerous other apps like RedLaser, Sudoku Grab, so it seems to be fine with Apples rules even thou it's private.
The hidden CATransition animations are dokumented here for example:
http://iphonedevwiki.net/index.php/UIViewAnimationState
However I'm not able to get any of the hidden ones to work, public ones work fine thou. Could this be a change of iOS 4? All information I do find on those hidden animations seems a little dated.
Here is my code:
CATransition *animation = [CATransition animation];
animation.delegate = self;
animation.duration = 2.0;
animation.timingFunction = UIViewAnimationCurveEaseInOut;
animation.type = #"cameraIris";
[self.window.layer addAnimation:animation forKey:nil];
Using "reveal" as 'animation.type' works fine with my code.
Has anybody played around with those on iOS 4 yet? Or is the issue totally different?
RedLaser uses this effect on iOS 4 (it's not an iOS 4 optimised app thou).
The animation is found in these other apps because it is Apple's implementation. Accessing the camera API will cause the shutter opening animation to appear. If you want to use this animation for your app in a non-camera api related way, then you will have to roll your own animation.