Swift : Background Color fading animation (SpriteKit)

前端 未结 3 1492
余生分开走
余生分开走 2021-01-07 10:42

I\'m creating a game, the background color is white to begin with hence:

self.backgroundColor = SKColor.whiteColor()

So when the game initi

3条回答
  •  挽巷
    挽巷 (楼主)
    2021-01-07 11:22

    To smoothly transition from the current background color to a different color, use the colorizeWithColor SKAction. Here's an example...

    runAction(SKAction.colorizeWithColor(SKColor.purpleColor(), colorBlendFactor: 1.0, duration: 2.0))
    

提交回复
热议问题