A SKSpriteNode's SKColor has a way to be created with Hue, Saturation, Brightness & Alpha:
let myColor = SKColor(hue: 0.5, saturation: 1, brightness: 1, alpha: 1)
mySprite.color = myColor
How do I get at the hue of a SKSpriteNode
and make a change to it? eg, divide it by 2.
An
SKSpriteNode
is a node that draws a texture (optionally blended with a color), an image, a colored square. So, this is it's nature.When you make an
SKSpriteNode
, you have an instance property that represent the texture used to draw the sprite called also textureSince iOS 9.x, we are able to retrieve an image from a texture following the code below. In this example I call my
SKSpriteNode
asspriteBg
:Following this interesting answer, we can translate it to a more confortable Swift 3.0 version:
So, finally with the previous code we can do: