Skip to content

Commit 93e5c9d

Browse files
committed
randomize key parameters
1 parent b3a26d3 commit 93e5c9d

File tree

2 files changed

+21
-15
lines changed

2 files changed

+21
-15
lines changed

drift/drift.pde

+16-11
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,10 @@
11
import processing.svg.*;
22
int cols,rows;
3-
int scale = 10;
4-
int z_scale = 20;
3+
int scale = 20;
4+
int z_scale = 90;
55
int w = 900;
66
int h = 700;
7-
float small = 0.5;
7+
float small = 0.4;
88

99
void setup() {
1010
size(750, 500, P3D);
@@ -14,14 +14,21 @@ void setup() {
1414
strokeWeight(1);
1515
stroke(0,0,0);
1616
noFill();
17-
18-
beginRaw(SVG, "drift_9.svg");
17+
int x_rot = round(random(3, 5));
18+
int y_rot = round(random(5, 8));
19+
int octave = round(random(1, 4));
20+
println(x_rot);
21+
String saveName = "drift_" + x_rot + "_" + y_rot + "_" + octave + ".svg";
22+
beginRaw(SVG, saveName);
1923

2024
// Move origin to rotate "camera"
2125
translate(width/2, height/3 * 2);
22-
rotateX(PI/5);
26+
27+
rotateX(PI/x_rot);
28+
rotateY(PI/y_rot);
29+
2330
// Move origin for placement of mesh
24-
translate(-w/2, -h/2, -h);
31+
translate(-w/2, -h/1.2, -h/8);
2532

2633
for (int y = 0; y < rows; y++) {
2734
beginShape(TRIANGLE_STRIP);
@@ -30,10 +37,8 @@ void setup() {
3037
float scaled_y = y * small;
3138
float scaled_yplus = (y + 1) * small;
3239
float z = x*1.2 + y*1.2;
33-
//noiseDetail(2,0.5);
34-
//noiseDetail(5, 0.4);
35-
//noiseDetail(8, 0.5);
36-
noiseDetail(6,0.6);
40+
41+
noiseDetail(octave, 0.5);
3742
vertex(x*scale, y*scale, noise(scaled_x,scaled_y)*z_scale + z);
3843
vertex(x*scale, (y+1)*scale, noise(scaled_x, scaled_yplus)*z_scale + z);
3944
}

fermat_spiral/fermat_spiral.pde

+5-4
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,8 @@ import processing.svg.*;
33
int _numPoints = 450;
44
float _angle = 137.5;
55
float _scale = 10;
6-
float _seedSize = 20;
6+
float _seedSize = random(8, 15);
7+
float _growScale = random(15, 30);
78
String _saveName = "fermat_spiral_";
89

910

@@ -25,7 +26,7 @@ void draw() {
2526
float x = 0;
2627
float y = 0;
2728

28-
float size = (n / 42) + _seedSize;
29+
float size = (n / _growScale) + _seedSize;
2930

3031
pushMatrix();
3132
translate(translateX, translateY);
@@ -42,7 +43,7 @@ void keyPressed() {
4243
}
4344

4445
void exportSVG() {
45-
String exportName = _saveName + round(_seedSize) + ".svg";
46+
String exportName = _saveName + round(_seedSize) + "_"+ round(_growScale) + ".svg";
4647
PGraphics pg = createGraphics(width, height, SVG, exportName);
4748
pg.beginDraw();
4849
pg.noFill();
@@ -58,7 +59,7 @@ void exportSVG() {
5859
float x = 0;
5960
float y = 0;
6061

61-
float size = (n / 42) + _seedSize;
62+
float size = (n / _growScale) + _seedSize;
6263

6364
pg.pushMatrix();
6465
pg.translate(translateX, translateY);

0 commit comments

Comments
 (0)