# \#codecember 2020 #1

**URL:** <https://discourse.processing.org/t/codecember-2020-1/26468>\
**Category:** Gallery\
**Created:** [December 23, 2020, 12:07pm UTC](https://discourse.processing.org/t/codecember-2020-1/26468 "2020-12-23T12:07:48Z")\
**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 23, 2020, 12:07pm UTC](https://discourse.processing.org/t/codecember-2020-1/26468/1 "2020-12-23T12:07:48Z")

</div>

```auto
int w = 10, h = 10,scl=60,r =10;
void setup() {
  size(600,600);
}
void draw() {
  background(0);
  stroke(255);
  for(int i = 0; i < w; i++) for(int j = 0; j < h; j++) {
    float a = getRotation( (i+0.5)*scl, (j+0.5)*scl, mouseX,mouseY);
    line( (i+0.5)*scl,(j+0.5)*scl,(i+0.5)*scl+cos(a)*r,(j+0.5)*scl+sin(a)*r);
  }
  circle(mouseX,mouseY,5);
}
float getRotation(float x,float y, float x2, float y2) {
  return( atan2(y2-y,x2-x));
}

```

 ![image](https://canada1.discourse-cdn.com/flex036/uploads/processingfoundation1/original/2X/4/452d2b6d29a4b69fe1bf11c23c3f7a4b9dbbb81e.png)

version 2: (following a circling dot)

```auto
int w = 30, h = 30,scl=20,r =10,cr = 200;
void setup() {
  size(600,600);
}
void draw() {
  background(0);
  stroke(255);
  float cx = width/2 + cos(TWO_PI/300*frameCount)*cr, cy= height/2 + sin(TWO_PI/300*frameCount)*cr;
  for(int i = 0; i < w; i++) for(int j = 0; j < h; j++) {
    float a = getRotation( (i+0.5)*scl, (j+0.5)*scl, cx,cy);
    line( (i+0.5)*scl,(j+0.5)*scl,(i+0.5)*scl+cos(a)*r,(j+0.5)*scl+sin(a)*r);
  }
  circle(cx,cy,5);
}
float getRotation(float x,float y, float x2, float y2) {
  return( atan2(y2-y,x2-x));
}

```

 ![image](https://canada1.discourse-cdn.com/flex036/uploads/processingfoundation1/original/2X/6/692bacb29c0e744c5761c3151620a42b87e2df42.png)
