title: Mask SKSpriteNode
body: <p>I add few nodes to my sks file, and now I want to add some mask to the most lowest node <code>SKSpriteNode</code>. Structure is as shown below:</p>
  
  <p><a href="https://i.stack.imgur.com/QeqTU.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/QeqTU.png" alt="enter image description here"></a></p>
  
  <p>where </p>
  
  <ul>
  <li>green - wordInfoHolder</li>
  <li>red - container for Label</li>
  <li>whiteText - label</li>
  </ul>
  
  <p>Now I want to hide part that is shown in red. To perform such action I read that <code>SKCropNode</code> can be used.</p>
  
  <p>I able to find all my nodes in scene file and save them to variables. </p>
  
  <pre><code>if let holder = childNode(withName: "wordInfoHolder") as? SKSpriteNode {
          wordInfoHolder = holder
          if let wordSwitchNode = wordInfoHolder?.childNode(withName:"wordSwitchNode") as? SKSpriteNode {
              self.wordSwitchNode = wordSwitchNode
  
              if let label = self.wordSwitchNode?.childNode(withName:"infoLabel") as? SKLabelNode {
                  wordSwitchLabelNode = label
              }
         }
  }
  </code></pre>
  
  <p>all 3 objects are stored and correct.</p>
  
  <p>Now I want to add some mask to root object.</p>
  
  <p>For such purpose I prepared mask image:</p>
  
  <p><a href="https://i.stack.imgur.com/8UROW.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/8UROW.png" alt="enter image description here"></a></p>
  
  <p>and try to do something like:</p>
  
  <pre><code>  guard let holder = wordInfoHolder else { return }
    let positionToSet = holder.position
    let mask = SKSpriteNode(imageNamed: "rectangle_mask")
    let cropNode = SKCropNode()
    holder.removeFromParent()
    cropNode.addChild(holder)
    cropNode.maskNode = mask
    cropNode.position = positionToSet
    self.addChild(cropNode)
  </code></pre>
  
  <p>But I see nothing. I expect to see green part of <code>SKSpriteNode</code>.</p>
  
  <p>What was done wrong?</p>