UIView “suck” animation

会有一股神秘感。 提交于 2019-12-18 12:28:06

问题


I'd like to use the UIView "sucking" transition (view is "sucked" into a point) referenced here:

http://iphonedevwiki.net/index.php/UIViewAnimationState#Using_suckEffect

The method above, however, uses private APIs, which makes it next to useless for an App Store app. How can I recreate a similar effect without relying on private APIs? I'm guessing the answer has to do with OpenGL, although I have zero experience there.


回答1:


As long as Apple doesn't publicly document the effect, and you want to avoid the risk of being rejected for using private API's you'll have to roll your own.

A suggestion to start working on this would be using OpenGL ES shaders.

The following blog post includes a demo Quartz Composer patch to create the Genie effect as seen in OS X and iOS: http://www.aderstedtsoftware.com/users/erik/weblog/c7cb9/

A good start for your OpenGL ES shader would be to use the code in the Genie Filter in this QuartzComposer file. The code can almost be copied to a shader for OpenGL as is. The most work would probably be integrating OpenGL in your application: rendering the right view to a OpenGL texture and overlaying OpenGL over your application to perform the animation based on your shader.




回答2:


Please have a look at my project at git://github.com/rmd6502/Genie.git - it's very slow right now, but improvements are forthcoming.




回答3:


have you checkked out the cocos2d framework. it's an objective c wrapper for openGL and it's done really well. you can check out their demo video which shows all the transition types that the library supports.



来源:https://stackoverflow.com/questions/2664472/uiview-suck-animation

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!