11

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.

Itay
  • 1,669
  • 5
  • 18
  • 23
  • Specifically, I'm looking for how to simulate the effect myself (or something similar), rather than use the private API (which will get my app rejected). – Itay Jun 20 '09 at 07:40

3 Answers3

1

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

Community
  • 1
  • 1
Marco Mustapic
  • 3,879
  • 1
  • 21
  • 20
  • I understand how to get the effect using the private API, but that's not what I'm after, as I would prefer my app not to be rejected :) Specifically, I'm looking for how to simulate the effect myself (or something similar). – Itay Jun 20 '09 at 07:29
  • Technically... this is an undocumented API, not a private API? It looks like you're still using the publicly available function calls. I think this is probably safe to use, but I'd throw in a flag so you can fall back to a lame effect if they disagree. – Ben Gotow Jun 26 '09 at 16:04
  • 1
    I'd like to believe you're right, but my intuition is telling me otherwise. I'll probably end up coming up with a different transition, unless somebody has some idea about how to implement this. – Itay Jun 26 '09 at 19:21
1

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

CIFilter
  • 8,647
  • 4
  • 46
  • 66
1

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.

jbrennan
  • 11,943
  • 14
  • 73
  • 115