开发者

Flame transition effect for iphone image

How would you impelement the following?

1. Image is loaded from a file

2. On Touch the picture burns in flame.

3. Next picture loads from another fi开发者_开发技巧le.

How would you make the flame transition?


Hands down I'd use some OpenGL ES code I wrote for doing non-standard transitions (about 300 lines of code) as a base, and build a flame transition this way -- because I already have the code existing of course.

Basically how it works is like this:

  1. Subclass UIView, set up a few properties including a EAGLContext, some GLuints representing textures of the views, etc.
  2. Tell the view that its backing layer is an EAGLContext by overriding +layerClass
  3. During initialization, pass another view in (your start view), and in this initialization phase, set up the GL context, take a texture of the view by capturing how it looks on the screen, save it for later.
  4. Define a transition method which takes another view (the one to transition to), and does similar actions to #3 above, but also calls your custom transition code -- i.e., your flame effect.

That said, even if I didn't, OpenGL ES would still be the way I'd look at doing this first, since it will give me desirable effects in terms of realism, safe timing, and fast performance.

Alternatively you can look at CoreAnimation, which may be simple enough for your needs.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜