开发者

How can i apply lens effect to my UIImage?

开发者 https://www.devze.com 2023-03-08 13:15 出处:网络
How can i apply lens effect to my UIImage like it sho开发者_如何学Cwn here http://processing.org/learning/topics/lens.html? You can use the Cocos2D framework to do that.

How can i apply lens effect to my UIImage like it sho开发者_如何学Cwn here http://processing.org/learning/topics/lens.html?


You can use the Cocos2D framework to do that.

If you choose to use it, here is how you can easily apply a lens effect:

- (void)aFunction
{
    const CGSize size = [[CCDirector sharedDirector] winSize];

    // Init and position your image
    CCSprite *img = [CCSprite spriteWithFile:@"images.png"];
    img.position = ccp(size.width/2.f, size.height/2.f);
    [self addChild:img];

    // Create action and start it
    id lens = [CCLens3D actionWithPosition:ccp(size.width/2.f, size.height/2.f)
                                    radius:240.f
                                      grid:ccg(15.f,10.f)
                                  duration:0.f];
    [img runAction:lens];
}

Your project is probably a UIKit project so you don't want to restart your project from scratch. So, in the cocos2d-ios Xcode project there are a lot of examples of what you can do.

And there is an exemple which is called AttachTest and it show you how implement an EAGLView (which is a subclass of UIView) in an UIKit project.

0

精彩评论

暂无评论...
验证码 换一张
取 消