Applying a CIFilter with SKEffectNode to a SKSpriteNode

大憨熊 提交于 2019-12-11 06:25:07

问题


I am trying to apply a CIFilter with SKEffectNode to a SKSpriteNode. Can't get this to work and not sure why. I got this working using a blur but cannot get the mono photo effect. Anyone have any insight? Thanks again.

//Mono Effect (not working)
    let filter = CIFilter(name: "CIPhotoEffectMono")
    filter?.setDefaults()
    effectsNode.filter = filter
    self.addChild(effectsNode)
    effectsNode.addChild(SKSpriteNode)

//Blur Effect (working)
    let filter = CIFilter(name: "CIGaussianBlur")
    let blurAmount = 4.0
    filter?.setValue(blurAmount, forKey: kCIInputRadiusKey)
    effectsNode.filter = filter
    effectsNode.blendMode = .alpha
    self.addChild(effectsNode)
    effectNode.addChild(SKSpriteNode)

来源:https://stackoverflow.com/questions/40413994/applying-a-cifilter-with-skeffectnode-to-a-skspritenode

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!