mirror of
https://github.com/processing/processing4.git
synced 2026-06-16 04:26:26 +02:00
blue book examples
This commit is contained in:
@@ -0,0 +1,23 @@
|
||||
/**
|
||||
* Synthesis 1: Form and Code
|
||||
* Riley Waves by Casey Reas (www.processing.org)
|
||||
* p. 151
|
||||
*
|
||||
* Step 1, creating the basic form.
|
||||
*/
|
||||
|
||||
|
||||
size(400, 400);
|
||||
background(255);
|
||||
float angle = 0.0;
|
||||
float magnitude = 24.0;
|
||||
|
||||
beginShape(TRIANGLE_STRIP);
|
||||
for(int x=0; x<=width; x=x+8) {
|
||||
float y = 50 + (sin(angle)* magnitude);
|
||||
angle += PI/48.0;
|
||||
float y2 = 70 + (sin(angle+PI/6)* magnitude);
|
||||
vertex(x, y);
|
||||
vertex(x, y2);
|
||||
}
|
||||
endShape();
|
||||
@@ -0,0 +1,27 @@
|
||||
/**
|
||||
* Synthesis 1: Form and Code
|
||||
* Riley Waves by Casey Reas (www.processing.org)
|
||||
* p. 151
|
||||
*
|
||||
* Step 2, the basic form is drawn many times inside a for structure.
|
||||
*/
|
||||
|
||||
|
||||
size(400, 400);
|
||||
background(255);
|
||||
float angle = 0.0;
|
||||
int magnitude = 18;
|
||||
|
||||
for(int i =- magnitude; i < height+magnitude; i = i+24) {
|
||||
|
||||
beginShape(TRIANGLE_STRIP);
|
||||
for(int x = 0; x <= width; x = x+8) {
|
||||
float y = i + (sin(angle)* magnitude);
|
||||
angle += PI/24.0;
|
||||
float y2 = i+10 + (sin(angle+PI/12) * magnitude);
|
||||
vertex(x, y);
|
||||
vertex(x, y2);
|
||||
}
|
||||
endShape();
|
||||
|
||||
}
|
||||
@@ -0,0 +1,70 @@
|
||||
/**
|
||||
* Synthesis 1: Form and Code
|
||||
* Riley Waves by Casey Reas (www.processing.org)
|
||||
* p. 151
|
||||
*
|
||||
* Step 3, values are modified to create a new pattern.
|
||||
*/
|
||||
|
||||
|
||||
size(1200, 280);
|
||||
background(255);
|
||||
smooth();
|
||||
noStroke();
|
||||
float angle = 0.0;
|
||||
float angle2 = 0.0;
|
||||
int magnitude = 8;
|
||||
|
||||
for(int i = -magnitude; i < height+magnitude; i = i+18) {
|
||||
|
||||
angle2 = angle;
|
||||
|
||||
fill(0);
|
||||
beginShape(TRIANGLE_STRIP);
|
||||
for(int x=0; x<=width; x=x+8) {
|
||||
float y = i + (sin(angle)* magnitude);
|
||||
angle += PI/24.0;
|
||||
float y2 = i+4 + (sin(angle+PI/12)* magnitude);
|
||||
vertex(x, y);
|
||||
vertex(x, y2);
|
||||
}
|
||||
endShape();
|
||||
|
||||
fill(204);
|
||||
beginShape(TRIANGLE_STRIP);
|
||||
for(int x=0; x<=width; x=x+8) {
|
||||
float y = i+4 + (sin(angle2+PI/12)* magnitude);
|
||||
angle2 += PI/24.0;
|
||||
float y2 = i+8 + (sin(angle2+PI/12)* magnitude);
|
||||
vertex(x, y);
|
||||
vertex(x, y2);
|
||||
}
|
||||
endShape();
|
||||
|
||||
/*
|
||||
fill(0);
|
||||
beginShape(TRIANGLE_STRIP);
|
||||
for(int x=0; x<=width; x=x+8) {
|
||||
float y = i + (sin(angle)* magnitude);
|
||||
angle += PI/16.0;
|
||||
float y2 = i+4 + (sin(angle+PI/24)* magnitude);
|
||||
vertex(x, y);
|
||||
vertex(x, y2);
|
||||
}
|
||||
endShape();
|
||||
|
||||
fill(204);
|
||||
beginShape(TRIANGLE_STRIP);
|
||||
for(int x=0; x<=width; x=x+8) {
|
||||
float y = i+4 + (sin(angle2+PI/24)* magnitude);
|
||||
angle2 += PI/16.0;
|
||||
float y2 = i+8 + (sin(angle2+PI/24)* magnitude);
|
||||
vertex(x, y);
|
||||
vertex(x, y2);
|
||||
}
|
||||
endShape();
|
||||
*/
|
||||
}
|
||||
|
||||
|
||||
// save("Synthesis-2--1.tif");
|
||||
@@ -0,0 +1,34 @@
|
||||
/**
|
||||
* Synthesis 1: Form and Code
|
||||
* Riley Waves by Casey Reas (www.processing.org)
|
||||
* p. 151
|
||||
*
|
||||
* Step 3, values are modified to create a new pattern.
|
||||
*/
|
||||
|
||||
|
||||
size(1200, 280);
|
||||
background(255);
|
||||
smooth();
|
||||
noStroke();
|
||||
fill(0);
|
||||
float angle = 0.0;
|
||||
int magnitude = 16;
|
||||
|
||||
for(int i = -magnitude; i < width+magnitude; i = i+16) {
|
||||
|
||||
fill(float(i)/width * 255);
|
||||
|
||||
beginShape(TRIANGLE_STRIP);
|
||||
for(int y = 0; y <= height; y = y+6) {
|
||||
float x = i + (sin(angle)* magnitude);
|
||||
angle += PI/22.0;
|
||||
float x2 = i+8 + (sin(angle+PI/22)* magnitude);
|
||||
vertex(x, y);
|
||||
vertex(x2, y);
|
||||
}
|
||||
endShape();
|
||||
|
||||
}
|
||||
|
||||
// saveFrame("Synthesis-2--2.tif");
|
||||
@@ -0,0 +1,37 @@
|
||||
/**
|
||||
* Synthesis 1: Form and Code
|
||||
* Riley Waves by Casey Reas (www.processing.org)
|
||||
* p. 151
|
||||
*
|
||||
* Step 3, values are modified to create a new pattern.
|
||||
*/
|
||||
|
||||
|
||||
size(1200, 280);
|
||||
background(255);
|
||||
smooth();
|
||||
noStroke();
|
||||
//fill(0);
|
||||
float angle = PI;
|
||||
float angle2 = PI;
|
||||
int magnitude = 3;
|
||||
|
||||
for(int i = -magnitude; i < height+magnitude; i = i+12) {
|
||||
|
||||
angle2 = angle;
|
||||
|
||||
fill(0);
|
||||
beginShape(TRIANGLE_STRIP);
|
||||
for(int x = 0; x <= width; x = x+8) {
|
||||
float y = i + (sin(angle)* magnitude);
|
||||
angle += PI/24.0;
|
||||
float y2 = i+4 + (sin(angle+PI/12)* magnitude);
|
||||
vertex(x, y);
|
||||
vertex(x, y2);
|
||||
}
|
||||
endShape();
|
||||
|
||||
}
|
||||
|
||||
|
||||
// save("Synthesis-2--3.tif");
|
||||
Reference in New Issue
Block a user