我想为3D球添加发光动画
let ball = SCNNode(geometry: SCNSphere(radius: 20))
let highlightAnimation = CABasicAnimation(keyPath: "contents")
highlightAnimation.toValue = UIColor.yellowColor()
highlightAnimation.fromValue = UIColor(hue: 0.01, saturation: 1,
brightness: 0.6, alpha: 1) //supposed to be dark red
//other unimportant codes for initialization
ball.geometry!.firstMaterial!.emission.addAnimation(highlightAnimation, forKey: nil)
当我运行程序时,颜色从鲜红色(相当于UIColor.redColor
)变为亮黄色而不是我想要的颜色。显然,该属性只接受默认UIColor
属性的颜色。有没有办法自定义颜色?
非常感谢