gpt4 book ai didi

ios - 对 Sprite 应用滤镜?

转载 作者:行者123 更新时间:2023-11-29 02:59:56 26 4
gpt4 key购买 nike

我正在开发一个 spritekit 游戏,其中 id 喜欢做我的 srite 的这种“漩涡”效果。

我添加的图片在一定程度上暗示了我想要完成的事情。

例如,如果我点击了宇宙飞船(在 imagE 中),我想对其使用这种“螺旋”效果(不完全是这种效果,而是一种旋转和扭曲我的 sknode 的效果。而不是整个场景。我想在我的 sprite 上使用 CIFilers,但我读到它们仅适用于图像。

任何关于这方面的提示都将不胜感激。

我有这个代码来旋转缩小播放器,只是不知道如何做漩涡模糊

 [_player runAction:
[SKAction sequence:@[
[SKAction group:@[
[SKAction rotateByAngle:M_PI * 4 duration:1.0],
[SKAction scaleTo:0 duration:1.0]
]],
]]];
}

enter image description here

最佳答案

马特用这段代码回答了一个类似的问题:

UIImage *ship = [UIImage imageNamed:@"Spaceship.png"];
CIImage *shipImage = [[CIImage alloc] initWithImage:ship];
CIFilter *filter = [CIFilter filterWithName:@"CISepiaTone" keysAndValues:kCIInputImageKey, shipImage, @"inputIntensity", [NSNumber numberWithFloat:0.6], nil];
CIContext *context = [CIContext contextWithOptions:nil];
CIImage *out = [filter outputImage];
CGImageRef cg = [context createCGImage:out fromRect:[out extent]];
SKTexture *texDone = [SKTexture textureWithCGImage:cg];

您可以在这里找到他的原始答案:SpriteKit SKTexture Crash

关于ios - 对 Sprite 应用滤镜?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/23434928/

26 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com