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:
- Subclass UIView, set up a few properties including a
EAGLContext
, someGLuint
s representing textures of the views, etc. - Tell the view that its backing layer is an
EAGLContext
by overriding+layerClass
- 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.
- 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.
精彩评论