I want to add a glowing animation for a 3D ball
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)
what happen is, when I run the program, the color changes from bright red (equivalent to UIColor.redColor
) to bright yellow instead of the color I want. Apparently the property only accepts the color from default UIColor
property. Is there any way to customize the color?
Thanks a lot