# "Rainbow" line; Running through colors

**URL:** https://discourse.processing.org/t/rainbow-line-running-through-colors/4777
**Category:** Gallery
**Created:** [October 23, 2018, 1:23pm UTC](https://discourse.processing.org/t/rainbow-line-running-through-colors/4777 "2018-10-23T13:23:54Z")
**Posts on this page:** 3
**Page:** 1

<div class="post-metadata">

### Author: ![Elrond\_void](https://avatars.discourse-cdn.com/v4/letter/e/f08c70/32.png) [@Elrond\_void](https://discourse.processing.org/u/Elrond_void)
#### Post date: [October 23, 2018, 1:23pm UTC](https://discourse.processing.org/t/rainbow-line-running-through-colors/4777/1 "2018-10-23T13:23:54Z")

</div>

I recently created a double pendulum and wanted to make the tracing line run through all the colors, I looked around and couldn’t find anything that did what I wanted so I made my own.

```auto
float h = 0;
float x = 0;

void setup(){
  size(500, 500);
  background(0);
  colorMode(HSB, 360, 360, 360);
}

void draw(){
  if (h > 360){
    h = 0;
  }
  h += 2;
  
  strokeWeight(4);
  stroke(h, 360, 360);
  point(x, height/2);
  x += 1;
}

```

This is what I came up with, hope this helps anyone looking for a similar thing.

Archie Wright.

---

<div class="post-metadata">

### Author: ![TheWizardBear](https://yyz2.discourse-cdn.com/flex036/user_avatar/discourse.processing.org/thewizardbear/32/3552_2.png) [@TheWizardBear](https://discourse.processing.org/u/TheWizardBear)
#### Post date: [October 23, 2018, 4:06pm UTC](https://discourse.processing.org/t/rainbow-line-running-through-colors/4777/2 "2018-10-23T16:06:07Z")

</div>

Could you format your code with the \</\> button please, and make sure it is properly indented by pressing ctrl + T in the processing editor?

---

<div class="post-metadata">

### Author: ![Elrond\_void](https://avatars.discourse-cdn.com/v4/letter/e/f08c70/32.png) [@Elrond\_void](https://discourse.processing.org/u/Elrond_void)
#### Post date: [October 23, 2018, 7:41pm UTC](https://discourse.processing.org/t/rainbow-line-running-through-colors/4777/3 "2018-10-23T19:41:10Z")

</div>

Done, thanks for the heads up.
