I am trying to programatically adjust a particleColorSequence of an SKEmitterNode in SpriteKit. I don’t want to replace the entire SKKeyframeSequence, but just alter the color of one of the keyframes. I think the way to do this is to use the setKeyframeValue method, but I cannot work out how to use it. Loading the emitter and trying to change the color like below does not work.
let emitter = SKEmitterNode(fileNamed: "FireWork_Flare_Standard") emitter?.particleColorSequence?.setKeyframeValue(UIColor.blue, for: 1)
Weirdly, when calling getKeyframeValue, I do see a color is associated with that keyframe, but I can’t seem to change it.
How can I change individual keyframes like this?