Drakalex
Drakalex

Reputation: 1538

How to change a spritenode opacity

I'm working using XCode 6, Sprite Kit and Swift and I have a node with this declaration:

var red = SKSpriteNode(imageNamed: "Rectangle")

and I want to change the opacity of the node, but I don't find how, except using a SKAction like FadeIn, FadeOut etc...

I tried changing red.colorBlendFactor but it's only change the opacity of a new color on the node, not the node's opacity...

Upvotes: 7

Views: 7134

Answers (1)

vacawama
vacawama

Reputation: 154603

Use SKNode's alpha property:

red.alpha = 0.5  // set red to 50% transparent

Upvotes: 16

Related Questions