Skip to content

Instantly share code, notes, and snippets.

@REAS
Created May 20, 2014 23:01
Show Gist options
  • Star 3 You must be signed in to star a gist
  • Fork 1 You must be signed in to fork a gist
  • Save REAS/1f3d11aea083153ea807 to your computer and use it in GitHub Desktop.
Save REAS/1f3d11aea083153ea807 to your computer and use it in GitHub Desktop.
Stochastic RGB textures
import processing.pdf.*;
color[] rgb = {
#FF0000, #00FF00, #0000FF
};
//SPACING BETWEEN LINES
float spMin = 2;
float spMax = 4;
float strokeWidth = 0.5;
void setup() {
size(792, 612);
}
void draw() {
beginRecord(PDF, "########.pdf");
background(255);
strokeWeight(strokeWidth);
for (int i = 0; i < rgb.length; i++) {
pushMatrix();
translate(width/2, height/2);
rotate(random(TWO_PI));
float sp = random(spMin, spMax);
for (float x = -width; x <= width; x+=sp) {
sp = random(spMin, spMax);
stroke(rgb[i]);
line(x+sp, -1080, x+sp, 1080);
}
popMatrix();
}
endRecord();
if (frameCount > 12) {
exit();
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment