ciechan / bcmeshtransformview Goto Github PK
View Code? Open in Web Editor NEWMesh transforms for UIView
License: MIT License
Mesh transforms for UIView
License: MIT License
Hi, I want to apply mesh to big image (ex: 2000x2000), but I got crash:
Failed to bind EAGLDrawable: <CAEAGLLayer: 0x281e7c080> to GL_RENDERBUFFER 1
Failed to make complete framebuffer object 8cd6
What can I do?, tnx
How I can apply more than one mesh transform without rendering image and replacing old image with it?
Hello,
When I add the UITableView to the BCMeshTransformView, the UITableView become very slow.
So I want to know if the BCMeshTransformView refresh the view every second.
The curtain demo is great but also it demonstrates the need for antialiasing in this framework.
Hi
Thanks for your wonderful lib.
Is there a way to resume content view animations while not using mesh transform no more ?
thanks for developing this great framework.
I want to add more depth to curtain folds and change position of top and bottom of curtain to keep on with pan more.
I want to mimic like this video:
https://vine.co/v/Mh5qd0HEpnt
how can I achieve?
thanks
Hi, I'm an newbie to gl. I wanna render to an image(not snapshot). I googled and found that glReadPixel meets my requirements. However it has some to do with FrameBuffer and I can't not find any trace of FrameBuffer in BCMeshTransformView.
Hi,
I wanted to use your library into my swift project. I've created an empty swift project and added your library via cocoa pods.
Here's my ViewController class:
import UIKit
import BCMeshTransformView
class ViewController: UIViewController {
var transformView:BCMeshTransformView!
var imageView:UIImageView!
var transform:BCMutableMeshTransform!
override func viewDidLoad() {
super.viewDidLoad()
// Do any additional setup after loading the view, typically from a nib.
transformView = BCMeshTransformView(frame: self.view.bounds)
transformView.autoresizingMask = [.flexibleWidth, .flexibleHeight]
imageView = UIImageView(image: UIImage(named: "picture.jpg")!)
imageView.center = CGPoint(x: transformView.contentView.bounds.midX, y: transformView.contentView.bounds.midY)
transformView.contentView.addSubview(imageView)
transformView.diffuseLightFactor = 0.0
transform = BCMutableMeshTransform.identityMeshTransform(withNumberOfRows: 20, numberOfColumns: 20)
transform.mapVertices { (vertex, vertexIndex) -> BCMeshVertex in
return BCMeshVertex(from: vertex.from, to: vertex.to)
}
transformView.meshTransform = transform
self.view.addSubview(transformView)
}
}
When I'm running the app nothing is showing. It's entirely white.
Removing this code:
transform = BCMutableMeshTransform.identityMeshTransform(withNumberOfRows: 20, numberOfColumns: 20)
transform.mapVertices { (vertex, vertexIndex) -> BCMeshVertex in
return BCMeshVertex(from: vertex.from, to: vertex.to)
}
transformView.meshTransform = transform
doesn't change anything.
But when in xcode I'm switching to "Show UI hierarchy" I can see an image:
Here's a whole sample project:
http://www116.zippyshare.com/v/IUTXbKJg/file.html
Why I cannot see anything? I tried making an example as simple as possible.
In you example demo, you create a ellipseMeshTransform to map square to circular. So how can I get the square point from circular point?
+ (instancetype)ellipseMeshTransform
{
BCMutableMeshTransform *transform = [BCMutableMeshTransform identityMeshTransformWithNumberOfRows:30 numberOfColumns:30];
[transform mapVerticesUsingBlock:^BCMeshVertex(BCMeshVertex vertex, NSUInteger vertexIndex) {
float x = 2.0 * (vertex.from.x - 0.5f);
float y = 2.0 * (vertex.from.y - 0.5f);
vertex.to.x = 0.5f + 0.5 * x * sqrt(1.0f - 0.5 * y * y);
vertex.to.y = 0.5f + 0.5 * y * sqrt(1.0f - 0.5 * x * x);
return vertex;
}];
return transform;
}
Hi,
I'm trying to take an screenshot of all the screen, but the view BCMeshTransformView class disappears.
I have tried to implement some possible solutions, but don't work for me:
http://stackoverflow.com/questions/11299682/programmatically-take-a-screenshot-combining-opengl-and-uikit-elements
http://stackoverflow.com/questions/10578389/iphone-screenshot-of-multiple-opengl-caeaglelayer-views
http://stackoverflow.com/questions/12564658/issue-with-renderincontext-with-opengl-views/15777434#15777434
Can you help me?
Thank you.
Does not appear to compile in xcode 6. Will there be an update?
I have a problem with BCMeshTransformView, especially with GLKView inside, which renders this view. In my case MeshTransform vertices can be outside view bounds, but GLKView clips view to it's bounds. I've tried setting clipsToBounds to false in GLKView, BCMeshTransformView and contentView, but it's still clipping the content. Is there any way to fix this? The only thing I can imagine right now is to set frame to the parent frame, but it'll break tons of stuff in my code, because I'm extending BCMeshTransformView, make calculations based on it's frame, using gestures etc.
Hi,
I'm trying to use BCMeshTransformView to obtain a modified UIImage from an existing UIImage. My code looks like this:
- (UIImage *)addSmile:(UIImage *)inputImage {
float scale = inputImage.scale;
CGRect imageRect = CGRectMake(0.f, 0.f, inputImage.size.width, inputImage.size.height );
UIImageView *imageView = [[UIImageView alloc] initWithImage:inputImage];
BCMeshTransformView *transformView = [[BCMeshTransformView alloc] initWithFrame:imageRect];
transformView.autoresizingMask = UIViewAutoresizingFlexibleHeight | UIViewAutoresizingFlexibleWidth;
transformView.diffuseLightFactor = 0.0;
transformView.meshTransform = [BCMutableMeshTransform buldgeMeshTransformAtPoint:CGPointMake(100, 100) withRadius:120.0 boundsSize:transformView.bounds.size];
[transformView.contentView addSubview:imageView];
UIView *containerView = [[UIView alloc] initWithFrame:imageRect];
[containerView addSubview:transformView];
UIGraphicsBeginImageContextWithOptions(workingImage.size, YES, scale);
[containerView.layer renderInContext:UIGraphicsGetCurrentContext()];
UIImage *outputImage = UIGraphicsGetImageFromCurrentImageContext();
UIGraphicsEndImageContext();
return outputImage;
}
When the references to the BCMeshTransformView are removed, outputImage is a copy of inputImage as expected. With the code above, outputImage is just a black rectangle with teh dimensions of inputImage.
Is BCMeshTransformView supposed to work in an offscreen context, or should I use a different approach to obtain a transformed UIImage?
Thanks very much!
Hi,
How to achieve pixel translation
I am currently trying to have my mesh transform 'flex' or bend using bezier curves. I am able to have my 'flex inwards' happen, but if I try to flex the view upwards, it is clipped by the bounds of the view. In looking through the code, I see that contentViewWrapperView has it's clipsToBounds set to YES. Setting this value to NO seems to have the mesh transform not be applied. I was hoping for some insight on why this happens, and if there is a way to allow the mesh transform to not be clipped.
I do not believe this matters, but for clarification I am applying this flex using the animations added by this fork : https://github.com/KevinDoughty/BCMeshTransformView
Hi,
very Interesting animation. Will it work on ios6 also?
Thanks;
The title says it all, I need a way to apply transformation on a UImage, or better render the whole view as one.
Is there an easy way? Cause, transformView.layer.render(in: rect)
won't work.
Thanks for the great project Ciechan
I'm trying to create a rotating control as in at the bottom of Apple's Camera app:
However, I'm not able to get the math right. I guess it is similar to buldgeMeshTransformAtPoint although it doesen't buldge out in the center, but caves in towards the edges. Do you know the solution to this?
-Mathias
It looks like the following line in BCMeshTransformView::CommonInit causes _display_link to hold a reference to the containing BCMeshTransformView. As a result, the transform view is never deallocated.
_displayLink = [CADisplayLink displayLinkWithTarget:self selector:@selector(displayLinkTick:)];
I'm temporarily working around this by exposing a method that allows me to call:
[_display_link invalidate]
when I'm done with the transform view. It is then deallocated when I'm done referencing it.
If there's a better way to handle this, please make a suggestion and I'll code it up and open a pull request.
Thanks again for this very useful project.
A declarative, efficient, and flexible JavaScript library for building user interfaces.
๐ Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. ๐๐๐
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google โค๏ธ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.