I have an light (of Omni type) and I want it to be a little animated. To be more exactly, I want to imitate a light from a file, so I want it's attenuationStartDistance
to change value, and same for the color
. So, it's there any way to run a such sequence on light it's self, or I have to find a little trick to do that?
Check the docs:
attenuationStartDistance
: The distance from the light at which its intensity begins to diminish. Animatable....
You can animate changes to this property’s value. See Animating SceneKit Content.
For a continuous animation, you can do something like this:
let flicker = CABasicAnimation(keyPath: "light.attenuationStartDistance")
flicker.fromValue = 100
flicker.toValue = 110
flicker.autoreverses = true
flicker.repeatCount = .infinity
lightNode.addAnimation(flicker, forKey: nil)