# Codecember 2020 #13

**URL:** https://discourse.processing.org/t/codecember-2020-13/26446
**Category:** Gallery
**Created:** [December 22, 2020, 3:40pm UTC](https://discourse.processing.org/t/codecember-2020-13/26446 "2020-12-22T15:40:50Z")
**Posts on this page:** 1
**Page:** 1

<div class="post-metadata">

### Author: ![CodeMasterX](https://yyz2.discourse-cdn.com/flex036/user_avatar/discourse.processing.org/codemasterx/32/2942_2.png) [@CodeMasterX](https://discourse.processing.org/u/CodeMasterX)
#### Post date: [December 22, 2020, 3:40pm UTC](https://discourse.processing.org/t/codecember-2020-13/26446/1 "2020-12-22T15:40:50Z")

</div>

#codecember

```auto
int maxAge = 200 , n = 100, maxRange = 150;
ArrayList<PVector> fromPath = new ArrayList<PVector>();
ArrayList<PVector> toPath = new ArrayList<PVector>();
ArrayList<Float> age = new ArrayList<Float>();

void setup() {
  fullScreen();
  //size(600,600);
  for(int i = 0; i < n; i++) {
    fromPath.add(new PVector(random(width),random(height)));
    toPath.add(new PVector(random(height),random(height)));
    age.add((float)random(maxAge));
  }
  colorMode(HSB);
}
void draw() {
  background(0);
  stroke(255);
  for(int i = 0; i < n; i++) {
    age.set(i,age.get(i)+1);
    circle( map(age.get(i),0,maxAge,fromPath.get(i).x,toPath.get(i).x), map(age.get(i),0,maxAge,fromPath.get(i).y,toPath.get(i).y),4);
    if(age.get(i) > maxAge) {
      fromPath.set(i,toPath.get(i));
      toPath.set(i,new PVector(random(width),random(height)));
      age.set(i,(float)0);
    }
  }
  for(int i = 0; i < n; i++) for(int j = 0; j < n; j++) {
    float x1 = map(age.get(i),0,maxAge,fromPath.get(i).x,toPath.get(i).x);
    float y1 = map(age.get(i),0,maxAge,fromPath.get(i).y,toPath.get(i).y);
    
    float x2 = map(age.get(j),0,maxAge,fromPath.get(j).x,toPath.get(j).x);
    float y2 = map(age.get(j),0,maxAge,fromPath.get(j).y,toPath.get(j).y);
    if(dist(x1,y1,x2,y2) < maxRange) {
      stroke(map(dist(x1,y1,x2,y2),0,maxRange,0,255),255,255, 255-map(dist(x1,y1,x2,y2),0,maxRange,0,255));
      line(x1,y1,x2,y2);
    }
  }
}

```

 ![image](https://canada1.discourse-cdn.com/flex036/uploads/processingfoundation1/original/2X/f/fb64b68843a99bf1027df6f6424cb531f4a837f2.jpeg)
