# How to change the color ramp of an SKEmitterNode?

**URL:** <https://forums.kodeco.com/t/how-to-change-the-color-ramp-of-an-skemitternode/86203>\
**Category:** Sprite Kit\
**Created:** [October 26, 2019, 1:31am UTC](https://forums.kodeco.com/t/how-to-change-the-color-ramp-of-an-skemitternode/86203 "2019-10-26T01:31:43Z")\
**Posts on this page:** 4\
**Page:** 1

<div class="post-metadata">

**Author:** ![denniswave](https://assets.chunter.kodeco.com/user_avatar/forums.kodeco.com/denniswave/32/102075_2.png) [@denniswave](https://forums.kodeco.com/u/denniswave)\
**Post date:** [October 26, 2019, 1:31am UTC](https://forums.kodeco.com/t/how-to-change-the-color-ramp-of-an-skemitternode/86203/1 "2019-10-26T01:31:43Z")

</div>

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.

```auto
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?

---

<div class="post-metadata">

**Author:** ![shogunkaramazov](https://assets.chunter.kodeco.com/user_avatar/forums.kodeco.com/shogunkaramazov/32/108826_2.png) [@shogunkaramazov](https://forums.kodeco.com/u/shogunkaramazov)\
**Post date:** [November 14, 2019, 3:09pm UTC](https://forums.kodeco.com/t/how-to-change-the-color-ramp-of-an-skemitternode/86203/2 "2019-11-14T15:09:54Z")

</div>

@denniswave Do you still have issues with this?

---

<div class="post-metadata">

**Author:** ![denniswave](https://assets.chunter.kodeco.com/user_avatar/forums.kodeco.com/denniswave/32/102075_2.png) [@denniswave](https://forums.kodeco.com/u/denniswave)\
**Post date:** [November 14, 2019, 6:19pm UTC](https://forums.kodeco.com/t/how-to-change-the-color-ramp-of-an-skemitternode/86203/3 "2019-11-14T18:19:49Z")

</div>

I have created a new color ramp instead, but this was more of a workaround. I never figured out how to change the color ramp created in the scene in code.

---

<div class="post-metadata">

**Author:** ![system](https://s3.amazonaws.com/cdn.raywenderlich.com/community/forum-assets/noun-game-ghost-878668.png) [@system](https://forums.kodeco.com/u/system)\
**Post date:** [April 9, 2020, 5:31pm UTC](https://forums.kodeco.com/t/how-to-change-the-color-ramp-of-an-skemitternode/86203/4 "2020-04-09T17:31:47Z")

</div>

This topic was automatically closed after 166 days. New replies are no longer allowed.
