Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to implement slurp effect on iPhone?

The iPhone has a private list of effects that Apple uses, such as "genieEffect" and "slurpEffect". I'm wondering how one would go about implementing the slurp effect (this is when you trash a mail message or a note).

I understand how to use Core Animation, but I'm not sure exactly what parts of it they're using to get that animation.

like image 628
Itay Avatar asked Jun 19 '09 18:06

Itay


3 Answers

This post talks about using the private API for the effect: link text

like image 125
Marco Mustapic Avatar answered Nov 02 '22 08:11

Marco Mustapic


It seems to be a complex combination of 2D and 3D transformations. :-\ You'd have to really delve into CoreAnimation to simulate this effect.

like image 45
CIFilter Avatar answered Nov 02 '22 07:11

CIFilter


I would do it with an affine transformation applied to the view's layer. Linear algebra is not my strong point ;) so I can't specify the exact transformation but my guess would be something like this for the animation:

  • Set the alpha to fade to 0.0 or something close to 0
  • Apply a transform to squish the two bottom corners close to the center
  • Scale down the view to very small
  • move the layer's center down to the bottom of the screen (or wherever you want it to genie to.

That's more or less how I think it would work. You might have to animate these things at different times, or all in one block, I'm not quite sure.

Have a look at documentation for CALayer, CABasicAnimation, and CGAffineTransform.

like image 1
mee Avatar answered Nov 02 '22 08:11

mee