Benja0906
Benja0906

Reputation: 1477

Fade animation for SKLabelNode changing text

Okay so I have implemented a simple SKLabelNode with some text.

I want to add a fade animation when I change the text.

I know there is an easy way to do it with UILabels but I cant figure out how to do it with SKLabels.

Upvotes: 2

Views: 957

Answers (1)

crashoverride777
crashoverride777

Reputation: 10674

You need to run an SKAction (fade) on it

let label = SKLabelNode(...
label.fontSize = ...
label.fontColor = ...
label.position = ...
addChild(label)

let fadeAction = SKAction.fadeAlphaTo(0.5, duration: 1)
label.runAction(fadeAction)

Hope that helps

Upvotes: 3

Related Questions