Swift iOS雪碧套件-雪碧从一种颜色变为另一种颜色
我需要在x时间内将精灵从一种颜色褪色到另一种颜色。 例如: 一个黄色的精灵在4秒内变为粉红色的精灵 如果可能,它需要接受十六进制颜色代码或类似的东西 谢谢!Swift iOS雪碧套件-雪碧从一种颜色变为另一种颜色,ios,swift,sprite-kit,Ios,Swift,Sprite Kit,我需要在x时间内将精灵从一种颜色褪色到另一种颜色。 例如: 一个黄色的精灵在4秒内变为粉红色的精灵 如果可能,它需要接受十六进制颜色代码或类似的东西 谢谢! 托比。您可以使用SKAction上的colorizeWithColor方法创建一个SKAction,该方法将更改SKSpriteNode的颜色。下面是一个例子: let node = SKSpriteNode(color: UIColor.greenColor(), size: CGSize(width: 50, height: 50))
托比。您可以使用
SKAction
上的colorizeWithColor
方法创建一个SKAction
,该方法将更改SKSpriteNode
的颜色。下面是一个例子:
let node = SKSpriteNode(color: UIColor.greenColor(), size: CGSize(width: 50, height: 50))
// Position and add the node to the scene...
let colorize = SKAction.colorizeWithColor(UIColor.redColor(), colorBlendFactor: 1.0, duration: 5.0)
node.runAction(colorize)
谢谢,我能够使用允许UIColor接受十六进制代码。