3

Possible Duplicate:
How can I replicate the trashing animation of Mail.app

I would use the trash effect like in the image app on the iPhone. I want to trash a UIView.

Does someone know how?

Community
  • 1
  • 1
Gustaf Rosenblad
  • 1,902
  • 2
  • 25
  • 45
  • See also [Genie or Similar Effect for Add to Favourites](http://stackoverflow.com/questions/4901446/genie-or-similar-effect-for-add-to-favourites) – Brad Larson Feb 17 '12 at 23:31

3 Answers3

6

Take a look at this answer: https://stackoverflow.com/a/5814846/656036

[UIView beginAnimations:@"suck" context:NULL];
[UIView setAnimationTransition:103 forView:webView cache:NO];
[UIView setAnimationDuration:1.5f];
[UIView setAnimationPosition:CGPointMake(300, 1)];
[UIView commitAnimations];

Note that this makes use of a private API and will get your App rejected by Apple. For other Animation-Transitions see http://iphonedevwiki.net/index.php/UIViewAnimationState

EDIT: iphonedevwiki.net seems to be down. However, I found something that could help you reproduce that effect and not get you rejected: (not tested) http://www.aderstedtsoftware.com/users/erik/weblog/c7cb9/

The different AnimationStates are the following (Taken from the linked SO answer):

// Efects for Animation.
// 0 (UIViewAnimationTransitionNone)                                 Yes    
// 1 (UIViewAnimationTransitionFlipFromLeft)     oglFlip, fromLeft   Yes    
// 2 (UIViewAnimationTransitionFlipFromRight)    oglFlip, fromRight  Yes    
// 3 (UIViewAnimationTransitionCurlUp)           pageCurl            Yes    
// 4 (UIViewAnimationTransitionCurlDown)         pageUnCurl          Yes    
// 101   pageCurl                                                    Yes
// 102   pageUnCurl                                                  Yes
// 103   suckEffect                                                  Yes
// 104   spewEffect                                                  No 
// 105   cameraIris                                                  Yes
// 106   cameraIrisHollowClose                                       Yes
// 107   cameraIrisHollowOpen                                        Yes
// 108   genieEffect                                                 No 
// 109   unGenieEffect                                               No 
// 110   rippleEffect                                                Yes    
// 111   twist                                                       No 
// 112   tubey                                                       No 
// 113   swirl                                                       No 
// 114   charminUltra                                                No 
// 115   zoomyIn                                                     No 
// 116   zoomyOut                                                    No 
// 117   oglApplicationSuspend                                       No
//---------------------------------------------------------------------
Community
  • 1
  • 1
fscheidl
  • 2,281
  • 3
  • 19
  • 33
1

The specific animation used is a private API and will likely get you rejected. It is however widely documented, you can find it by searching around on SO.

You can approximate the animation used one by taking a view's layer and simultaneously transforming by rotating, applying perspective, and moving/scaling the view with Core Animation.

How to make "suckEffect" to the left corner of iPhone?

Community
  • 1
  • 1
isaac
  • 4,867
  • 1
  • 21
  • 31
1

You can use CAAnimation to animate scale the image.

There is a video walkthrough on iTunes named Building Animation Driven Interfaces from WWDC 2010. This wil help you get started. Be sure to check CoreAnimation in Practice Part 1/2 from WWDC 2010 as well. It's really quality tutorials.

hellozimi
  • 1,858
  • 19
  • 21