Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Warp \ bend effect on a UIView?

I'm trying to get a similar effect to the one described in the pictures. The white area on the left isn't on the original photo, it pushes the pixels away. I've tried using Core Image (which offered a few close effects to this) but it was too slow for my needs. I need the effect to be snappy so I can make it responsive to touch.

Is there a close effect \ animation in the iOS sdk that does something similar to this with a UIVIew? ( I couldn't find anything close) If not, can someone offer how to attack this using OpenGL? (code examples are more than welcome)

(This effect will take an important roll in an open source class I'm writing so I'd prefer not to use a 3rd party class such as GPUImage if a simpler solution is available (I'm targeting this class to be dependencies free))

enter image description hereenter image description hereenter image description here

like image 434
Segev Avatar asked Dec 31 '13 22:12

Segev


2 Answers

Another thing you might look at is the Core Image hole distortion filter (CIHoleDistortion) that was added in iOS 6. It creates an effect rather like what you're looking for. Here is a sample image generated from a test program I wrote that gets pretty close.

However, you'll notice that Apple's filter causes the image to "pull away" from the edges of the frame. I think this is a bug, but good luck getting Apple to fix it:

enter image description here

like image 86
Duncan C Avatar answered Oct 31 '22 12:10

Duncan C


There's a new great open source class that answers my question completely with a magnificent example. You can find it here.

enter image description here

like image 23
Segev Avatar answered Oct 31 '22 12:10

Segev