Skip to content

Commit

Permalink
adding all the files for the examples
Browse files Browse the repository at this point in the history
  • Loading branch information
digitalcoleman committed Jan 7, 2018
1 parent 27d1afc commit aa62667
Show file tree
Hide file tree
Showing 19 changed files with 425 additions and 1 deletion.
21 changes: 20 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
@@ -1 +1,20 @@
# generativeExamples
# generativeExamples

This is a collection of examples made in Processing that export pdfs for plotting. Across the examples are different methods to create patterns that are affected by Perlin noise. The patternMaker is a more robust application with a gui and the ability to drag and drop in svg files to try out many shapes.
### generativeHlines
![sample1](./images/hLines.png)

### generativeHashMarks
![sample1](./images/hashLines.png)

### generativeCircles
![sample1](./images/circlesNoise.png)

### generativeDecagonGrid
![sample1](./images/decaGrid.png)

### generativeArrowRotate
![sample1](./images/arrowTurn.png)

### patternMaker_v2
![sample1](./images/patternM.png)
Binary file added generativeArrowRotate/Line_0.pdf
Binary file not shown.
59 changes: 59 additions & 0 deletions generativeArrowRotate/generativeArrowRotate.pde
Original file line number Diff line number Diff line change
@@ -0,0 +1,59 @@
/**
* Example of using noise to rotate a grid of arrows
*/
int version = 0; //if we grab multiple frames, they will be numbered
float timeSeed = 0.1; //seed for the third dimension of the noise

import processing.pdf.*;

boolean saveOneFrame = false;

void setup() {
size(1000, 1000); //resolution does not really matter since we are working with vectors
frameRate(24);
smooth();
}

void draw() {
if (saveOneFrame == true) { //turn on recording for this frame if we clicked the mouse
beginRecord(PDF, "Line_"+version+".pdf");
}

background(255);
noFill();
stroke(0);
strokeWeight(1);
timeSeed = millis()/5000.0; //change noise over time
for (int cy = 40; cy < height; cy+=40) { //iterate down the page
for (int cx = 40; cx < width; cx+=40) { //iterate across the page
pushMatrix();
translate(cx, cy); //set the position of each arrow
rotate(4.0*PI*noise(cx/400.0, cy/400.0, timeSeed)); //rorate using noise
scale(1);
arrow(); //draw our arrow
popMatrix();
}
}
if (saveOneFrame == true) {
endRecord();
saveOneFrame = false;
}
}

void mousePressed() {
saveOneFrame = true;
}

void arrow() { //custom shape for our arrow
beginShape();
vertex(0, -55);
vertex(6, 0);
vertex(16, 10);
vertex(2, 10);
vertex(0, -10);
vertex(-2, 10);
vertex(-16, 10);
vertex(-6, 0);
vertex(0, -55);
endShape();
}
Binary file added generativeCircles/Line_0.pdf
Binary file not shown.
51 changes: 51 additions & 0 deletions generativeCircles/generativeCircles.pde
Original file line number Diff line number Diff line change
@@ -0,0 +1,51 @@
/**
* Example of co-centric circles plus Perlin Noise
*/
int version = 0; //if we grab multiple frames, they will be numbered
float timeSeed = 0.6; //seed for the third dimension of the noise
PVector l1, l2; //two points for our lines

import processing.pdf.*;

boolean saveOneFrame = false;

void setup() {
size(1000, 1000); //resolution does not really matter since we are working with vectors
frameRate(24);
smooth();
}

void draw() {
if(saveOneFrame == true) { //turn on recording for this frame if we clicked the mouse
beginRecord(PDF, "Line_"+version+".pdf");
}

background(255);
noFill();
stroke(0);
strokeWeight(1);
translate(width/2, height/2); //start at the middle of the canvas
//timeSeed = millis()/2000.0; //change noise over time

for(float dia = 10.0; dia< width; dia+=10.0){ //iterate the diameter of the circles bigger
beginShape();
float div = 2.0*PI/(dia/2.0); //divide 2PI over the number of sides
for(float a = 0; a<=2.0*PI; a+=div){ //iterate around the circle
float x = (cos(a)*dia); //change polar coordinates to cartesian
float y = (sin(a)*dia);
x += 400.0* noise(x/200.0, y/200.0, timeSeed)-200; //add some noise to change the position
y += 400.0* noise(x/200.0, y/200.0, timeSeed)-200;
vertex(x, y); //add a point to the circle
}
endShape(CLOSE);
}

if(saveOneFrame == true) {
endRecord();
saveOneFrame = false;
}
}

void mousePressed() {
saveOneFrame = true;
}
Binary file added generativeDecagonGrid/Line_0.pdf
Binary file not shown.
50 changes: 50 additions & 0 deletions generativeDecagonGrid/generativeDecagonGrid.pde
Original file line number Diff line number Diff line change
@@ -0,0 +1,50 @@
/**
* Example of a grid of decagons with perlin noise
*/
int version = 0; //if we grab multiple frames, they will be numbered
float timeSeed = 0.1; //seed for the third dimension of the noise
float noiseStr = 80.0; //strength of the noise effect

import processing.pdf.*;

boolean saveOneFrame = false;

void setup() {
size(1000, 1000); //resolution does not really matter since we are working with vectors
frameRate(24);
smooth();
}

void draw() {
if (saveOneFrame == true) { //turn on recording for this frame if we clicked the mouse
beginRecord(PDF, "Line_"+version+".pdf");
}

background(255);
noFill();
stroke(0);
strokeWeight(1);
timeSeed = millis()/5000.0; //change noise over time
for (int cy = 0; cy < height+100; cy+=50) { //iterate down the page
for (int cx = 0; cx < width+100; cx+=50) { //iterate across the page
beginShape();
float div = 2.0*PI/10.0; //divide 2PI into 1/10ths
for (float a = 0; a<=2.0*PI; a+=div) { //work around the circle
float x = (cos(a)*60) + cx; //convert polar to cartesian
float y = (sin(a)*60) + cy;
x += noiseStr* noise(x/150.0, y/150.0 + timeSeed*2, timeSeed)-100; //add noise to each point
y += noiseStr* noise(x/150.0, y/150.0 + timeSeed*2, timeSeed)-100;
vertex(x, y); //add the point to the shape
}
endShape(CLOSE);
}
}
if (saveOneFrame == true) {
endRecord();
saveOneFrame = false;
}
}

void mousePressed() {
saveOneFrame = true;
}
Binary file added generativeHashMarks/Line_0.pdf
Binary file not shown.
48 changes: 48 additions & 0 deletions generativeHashMarks/generativeHashMarks.pde
Original file line number Diff line number Diff line change
@@ -0,0 +1,48 @@
/**
* Example of horizontal lines with spaces creating hash marks with Perlin Noise
*/
int version = 0; //if we grab multiple frames, they will be numbered
float timeSeed = 0.6; //seed for the third dimension of the noise
PVector l1, l2; //two points for our lines

import processing.pdf.*;

boolean saveOneFrame = false;

void setup() {
size(1000, 1000); //resolution does not really matter since we are working with vectors
frameRate(24);
l1 = new PVector(0,0); //setup our points
l2 = new PVector(0,0);
smooth();
}

void draw() {
if(saveOneFrame == true) { //turn on recording for this frame if we clicked the mouse
beginRecord(PDF, "Line_"+version+".pdf");
}

//timeSeed = millis()/2000.0; //change noise over time
background(255);
noFill();
stroke(0);
strokeWeight(1);

for(int j = -200; j< height*2; j+=5){ //iterate down the page
l1.set(0, j-(noise(0, j/300.0, timeSeed)*200.0)-500.0); //reset the initial point at the start of each new line
for(float i = 0; i<width+40; i+=40){ //iterate across the page
l2.set(i-10, j+(noise(i-10.0/600.0, j/600.0, timeSeed)*200.0)-500.0); //set the next point in the line
line(l1.x, l1.y, l2.x, l2.y); //draw a line from the last point to the new one
l1.set(i, j+(noise(i/600.0, j/600.0, timeSeed)*200.0)-500.0); //copy the new point into the old variable for the next loop
}
}

if(saveOneFrame == true) {
endRecord();
saveOneFrame = false;
}
}

void mousePressed() {
saveOneFrame = true;
}
Binary file added generativeHlines/Line_0.pdf
Binary file not shown.
48 changes: 48 additions & 0 deletions generativeHlines/generativeHlines.pde
Original file line number Diff line number Diff line change
@@ -0,0 +1,48 @@
/**
* Example of generative piece using horizontal lines and Perlin Noise
*/
int version = 0; //if we grab multiple frames, they will be numbered
float timeSeed = 0.6; //seed for the third dimension of the noise
PVector l1, l2; //two points for our lines

import processing.pdf.*;

boolean saveOneFrame = false;

void setup() {
size(1000, 1000); //resolution does not really matter since we are working with vectors
frameRate(24);
l1 = new PVector(0,0); //setup our points
l2 = new PVector(0,0);
smooth();
}

void draw() {
if(saveOneFrame == true) { //turn on recording for this frame if we clicked the mouse
beginRecord(PDF, "Line_"+version+".pdf");
}

//timeSeed = millis()/2000.0; //change noise over time
background(255);
noFill();
stroke(0);
strokeWeight(1);

for(int j = -200; j< height*2; j+=5){ //iterate down the page
l1.set(0, j-(noise(0, j/300.0, timeSeed)*1000.0)-500.0); //reset the initial point at the start of each new line
for(float i = 0; i<width+40; i+=40){ //iterate across the page
l2.set(i, j+(noise(i/300.0, j/300.0, timeSeed)*1000.0)-500.0); //set the next point in the line
line(l1.x, l1.y, l2.x, l2.y); //draw a line from the last point to the new one
l1=l2.copy(); //copy the new point into the old variable for the next loop
}
}

if(saveOneFrame == true) {
endRecord();
saveOneFrame = false;
}
}

void mousePressed() {
saveOneFrame = true;
}
Binary file added images/arrowTurn.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added images/circlesNoise.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added images/decaGrid.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added images/hLines.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added images/hashLines.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added images/patternM.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added patternMaker_v2/pattern1.pdf
Binary file not shown.
Loading

0 comments on commit aa62667

Please sign in to comment.