我想知道是否可以反转SKSpriteNode的颜色(或调整色调). 最佳答案 您可以通过应用带有SKEffect节点的CIFilter来反转颜色.这样的事情应该有效:
SKEffectNode *effectNode = [[SKEffectNode alloc] init];
effectNode.filter = [CIFilter filterWithName:@"CIColorInvert"];
SKSpriteNode *node = yourNode; // Make sure this node doesn't already have a parent
[effectNode addChild:node];
[self addChild:effectNode];
请注意,SKScene是一个效果节点,因此可以非常轻松地反转整个场景:
// self is a scene here
self.filter = [CIFilter filterWithName:@"CIColorInvert"];
self.shouldEnableEffects = YES;