ring segments

Nikolaus Gradwohl2018-02-01T08:02:20+00:00

I created new images I can hang on my livingroom walls using processing. This time I wrote a sketch, that creates circular shapes made of 64 line segments. Each segment can be shifted by a fixed offset if a certain random number is exceeded. I used this method to generate for concentric rings and added a keyPress method that saves the current frame as a png file and creates a new ring pattern.

I also added a little blur effect to create a subtle shadow effect. I generated a bunch of images selected 3 and printed them on an A3 printer

segments

Here is the processing code I used to generate the patterns - certainly not the most polished code ever, but it works.

int seg[][] = new int[4][64];

void setup() {
  size(1600, 1600, P3D);
  smooth();
  initSeg();
}

void draw() {
  background(255);
  translate(width/2, height/2);
    scale(2);
  noFill();
  strokeWeight(2);
  stroke(128);
  drawSeg();
  filter(BLUR,2);
  stroke(0);
  drawSeg();
}

void keyPressed() {
  initSeg();
  saveFrame("seg-####.png");
}

void drawSeg() {
  float p = 2*PI/64;
  for (int j=0; j<4; j++) {
    beginShape();
    for (int i=0; i<64; i++) {
      vertex(cos(p*i)*seg[j][i], sin(p*i)*seg[j][i]);
      vertex(cos(p*(i+1))*seg[j][i], sin(p*(i+1))*seg[j][i]);
    }
    endShape(CLOSE);
  }
}

void initSeg() {
  for (int j=0; j<4; j++) {
    int r = 250 + 30 * j;
    for (int i=0; i<64; i++) {
      seg[j][i] = random(100)<30? r-5: r+5;
    }
  }
}
Tweet This! submit to reddit Digg! Tags: | no comments | no trackbacks

See also:

sketch experiment 7 - osc events
nested cubes in processing
processing phaseflower
Time Perception
de jong attractor

Trackbacks

Comments

Leave a response

Leave a comment