I would like my buttons to fade in when changing scene rather than just be their.
I am using sprite kit and UIView.animateWithDuration
doesn't work.
How else could you do it using sprite kit in swift?
I would like my buttons to fade in when changing scene rather than just be their.
I am using sprite kit and UIView.animateWithDuration
doesn't work.
How else could you do it using sprite kit in swift?
I'm assuming you are using UIButtons, and you really shouldn't, use only SKNodes (Sprites, Shapes, Labels, etc) and the methods of touch handle like: touchBegan: touchMoved: TouchEnded:
If you want to build a button or a switch for generic use, you should try this control I made, the use its pretty straight forward:
You just initialize the type of Button/Switch you want (ColoredSprite, Textured or TextOnly)
let control = TWButton(normalColor: SKColor.blueColor(), highlightedColor: SKColor.redColor(), size: CGSize(width: 160, height: 80))`
And after initialize you add a closure to it (like addTargetForSelector on UIButton)
control.addClosureFor(.TouchUpInside, target: self, closure: { (scene, sender) -> () in
scene.testProperty = "Changed Property"
})
}
That’s it! There’s more info on the readme section on the GitHub page: https://github.com/txaidw/TWControls
Then you can use actions to fade your button
SKAction.fadeAlphaTo(alpha:, duration:)