title: Swift : Background Color fading animation (SpriteKit)
body: <p>I'm creating a game, the background color is white to begin with hence:</p>
  
  <pre><code>self.backgroundColor = SKColor.whiteColor()
  </code></pre>
  
  <p>So when the game initiates white is the background. I have a scoring system, so essentially I want the colors to change when a certain score is reached hence:</p>
  
  <pre><code>if score &lt; 100{
              enemy.runAction(SKAction.moveTo(mainBall.position, duration:3))  
          }
          else if score &gt;= 100 &amp;&amp; score &lt; 200{
              enemy.runAction(SKAction.moveTo(mainBall.position, duration:2.5))
              self.backgroundColor = SKColor.purpleColor()
          }
          else if score &gt;= 200 &amp;&amp; score &lt; 300{
              enemy.runAction(SKAction.moveTo(mainBall.position, duration:2))
              self.backgroundColor = SKColor.greenColor()
          }
  </code></pre>
  
  <p>however, this method is very clunky and looks pretty awful if I'm honest. Everything in my game is fluid and contains fades when being removed from the scene using:</p>
  
  <pre><code>livesLabel.runAction(SKAction.fadeInWithDuration(0.5))
  </code></pre>
  
  <p>But I am unsure as to how I would proceed to do this with the background color. If I use the above example with backgroundColor such as </p>
  
  <pre><code>self.backgroundColor = SKAction.fadeInWithDuration(SKColor.purpleColor())
  </code></pre>
  
  <p>I get the error "Cannot invoke 'fadeInWithDuration' with an argument list of type '(UIColor)'"</p>
  
  <p>Note: I understand completely that attempting to assign the background color to an animation is silly. But I put that code in there to try get my problem across</p>