如何将镜头特效应用于我的UIImage,如这里所示http://processing.org/learning/topics/lens.html
发布于 2011-05-25 23:41:39
您可以使用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的子类)。
https://stackoverflow.com/questions/6126515
复制相似问题