agens-no / AGGeometryKit

Quadrilaterals on CALayer, CGGeometry-functions, UIView/CALayer properties and other invaluable tools.
Other
1.27k stars 130 forks source link

Multiple Drag points + Video #41

Open omarojo opened 8 years ago

omarojo commented 8 years ago

In your demo video you show an image with 4 corners being dragged and morphed. Is it possible to have more than one drag point to transform the view ? also is it possible to load a video inside instead of an image ?

hfossli commented 8 years ago

Is it possible to have more than one drag point to transform the view ?

Do you want to have more control points than 4? In the sense that you want more corners? In other words a mesh? In that case you need to do go with a hacky solution (e.g. https://github.com/facebookarchive/spacetime) or you can render your view/layer to a bitmap/image and (e.g. http://ciechanowski.me/blog/2014/05/14/mesh-transforms/).

also is it possible to load a video inside instead of an image ?

It is just a simple CATransform3D which is being applied to the backing layer. So you can do this with webviews, videos, any UIView and CALayer at no performance cost at all!

hfossli commented 8 years ago

Also, check out this fun project https://github.com/agens-no/AGGeometryKit-POP. Adding dynamics to these control points is interesting.

omarojo commented 8 years ago

Thank you for your fast reply @hfossli . Yes Im looking for a mesh because I want to do something similar to this interaction : http://dynamapper.net/how-to-use

Rectangles are fine but when you want to map around irregular objects then you need multiple drag points to make the mesh.. sometimes not only in the corners but also inner.

hfossli commented 8 years ago

Is this going on app store or can you use private API's? In that case I would guess https://github.com/Ciechan/BCMeshTransformView is the best way to go with regards to video and multiple control points.

Or you could use AGGeometryKit and split the video stream in to as many rectangles as needed – app store friendly, but probably a bit less performant as you would need to split the video and clip each rectangle.

hfossli commented 7 years ago

Any luck? :)