Skip to content

Instantly share code, notes, and snippets.

Embed
What would you like to do?
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