问题描述
|
我如何将镜头效果应用于http://processing.org/learning/topics/lens.html所示的UIImage?
解决方法
您可以使用Cocos2D框架来做到这一点。
如果选择使用它,可以通过以下方法轻松地应用镜头效果:
- (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];
}
您的项目可能是一个UIKit项目,因此您不想从头开始重新启动项目。因此,在cocos2d-ios Xcode项目中,有许多您可以执行的示例。
有一个名为AttachTest的示例,它向您展示了如何在UIKit项目中实现EAGLView(这是UIView的子类)。