我们可以在CABasicAnimation中指定UIColor值吗?

时间:2015-10-22 10:38:54

标签: xcode swift uicolor cabasicanimation scnnode

我想为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属性的颜色。有没有办法自定义颜色?

非常感谢

0 个答案:

没有答案