Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

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...

like image 720
Drakalex Avatar asked Dec 06 '14 17:12

Drakalex


1 Answers

Use SKNode's alpha property:

red.alpha = 0.5  // set red to 50% transparent
like image 94
vacawama Avatar answered Nov 25 '22 14:11

vacawama