xxxxxxxxxx
/*
Nicholas Nowak
Art3001
Randomized barcode making, press play to have a different looking barcode
March 2, 2017
*/
//import processing.pdf.*;
float x = 0;
float line1 = random(-.5, .5);
void setup() {
//size(2000, 2000, PDF, "filename.pdf");
size(2000, 2000);
background(255);
stroke(255);
}
//Lines being drawn
void draw() {
float line2 = random(0 ,.5);
//4 lines in sections
line(x, 0, x, 500);
line(x, 500, x/line2, 1000);
line(x/line2, 1000, x, 1500);
line(x, 1500, x, 2000);
//Black line probability
if (random(100) > 90) {
//White space probability
if (random(100) > 45) {
stroke(0);
}
else {
stroke(255);
}
}
//When hits edge, resets and takes photo
x = x + 1;
if (x > width+100) {
x = 0;
//saveFrame("barcode-#######.png");
//exit();
}
}