title: Make A SKSpriteNode Flash White
body: <p>I'm trying to making a sprite flash white, like when it takes on damage. This would involve controlling some parameter via an SKAction. First I tried using an SKCropNode in conjunction with a white SKShapeNode, but I don't think I completely understand how that works because it didn't do anything. My second attempt was to colorize the sprite, but I've found out that when you colorize a sprite white, it just shows its original colours. I'm sure a shader would work, but I don't have much experience with them. Any ideas?</p>
  
  <p><strong>[EDIT]</strong></p>
  
  <p>Ok, after reading a million more websites on the this topic, I came across the following <a href="http://stackoverflow.25lm.com/questions/23921904/ios-7-ipad-spritekit-use-irregular-skshapenode-as-mask-for-skcropnode" rel="nofollow">SO question</a>, which said that SKCropNodes only work with SKSpriteNodes (for masking, etc). So I've updated my code and allows my sprite to turn white. I thought I'd be able to run an SKAction to turn down the alpha on the white SKSpriteNode to reveal the masking node, but that just makes the entire sprite disappear. So then I thought maybe I can add the original image to the SKCropNode, but then the white SKSpriteNode goes away. I decided to create an SKAction to dim the white SKSpriteNode and then add the original node to the SKCropNode. It works, but is there a better way?</p>
  
  <pre><code>SKSpriteNode *prod = [SKSpriteNode spriteNodeWithImageNamed:@"some image"];
  [prod setSize:CGSizeMake(prod.frame.size.width*0.2, prod.frame.size.height*0.2)];
  prod.zPosition = -1;
  
  SKSpriteNode *mask = [SKSpriteNode spriteNodeWithImageNamed:@"some image"];
  [mask setSize:CGSizeMake(mask.frame.size.width*0.2, mask.frame.size.height*0.2)];
  mask.zPosition = 1;
  //mask.position = CGPointMake(300, 300);
  
  SKSpriteNode *shape = [SKSpriteNode spriteNodeWithColor:[NSColor whiteColor] size:CGSizeMake(800, 600)];
  shape.zPosition = 2;
  
  SKCropNode *cropNode = [SKCropNode node];
  cropNode.maskNode = mask;
  
  [cropNode addChild:shape];
  //[cropNode addChild:prod];
  cropNode.position = CGPointMake(300, 300);
  [self addChild:cropNode];
  
  SKAction *fadeOut = [SKAction fadeAlphaTo:0 duration:0.1];
  [shape runAction:fadeOut completion:^{
      [cropNode addChild:prod];
  }];
  </code></pre>