0

I want to invert the color from the part of the HelloLable which is outside of the boxSprite. I know that it is possible with SKEffectNode but I don't know how.

class GameScene: SKScene {
    override func didMoveToView(view: SKView) {
        let box = SKSpriteNode()
        box.position = CGPoint(x: size.width/2-100, y: size.height/2)
        box.color = UIColor.blackColor()
        box.size = CGSize(width: 200, height: 200)
        addChild(box)
        
        let HelloLable = SKLabelNode()
        HelloLable.text = "Hello"
        HelloLable.position = CGPoint(x: size.width/2, y: size.height/2)
        HelloLable.fontColor = UIColor.whiteColor()
        HelloLable.fontSize = 50
        addChild(HelloLable)
    }
Jason Aller
  • 3,541
  • 28
  • 38
  • 38
Chipchip
  • 11
  • 3
  • See [this answer](http://stackoverflow.com/a/31386835/2448305) for how to invert colors with SKEffectNode. – Ben Kane Jul 13 '15 at 15:19

1 Answers1

1

If I understand you correctly, you'd like to make something like this: Example 1

I don't think there is a standard solution to do this (maybe you could try blending modes or shaders). Maybe the easiest solution could be to make 2 labels, one white in the box, and one black under the box, with similar properties, and clip the white one with the box.

Endanke
  • 867
  • 13
  • 24