float xPos, yPos, wdth, hght, irreg;
int paperW, paperH, paperX, paperY;
drawPaper(paperX, paperY, paperW, paperH);
for (int i = 0; i < 8; i++) {
xPos = random(paperX +10, paperX + paperW - wdth - irreg);
yPos = random(paperY + 10, paperY + paperH - hght - irreg);
drawQuad(xPos, yPos, wdth, hght, irreg);
void drawQuad(float x, float y, float w, float h, float irregular) {
float adjX = random(-irregular, irregular);
float adjY = random(-irregular, irregular);
drawLine(x, y, x + w + adjX, y + adjY);
float adjX2 = random(-irregular, irregular);
float adjY2 = random(-irregular, irregular);
drawLine(x+w + adjX, y + adjY, x + w + adjX2, y + h + adjY2);
float adjX3 = random(-irregular, irregular);
float adjY3 = random(-irregular, irregular);
drawLine(x+w + adjX2, y+h+ adjY2, x+ adjX3, y+h+ adjY3);
drawLine(x + adjX3, y+h+adjY3, x, y);
void drawLine(float strtx, float strty, float finx, float finy) {
strokeWeight(random(.1, 1.5));
for (int j = 0; j <= int (numSegs); j++) {
float x = (randomGaussian()*.3) +x1 + (fraction * (finx-x1));
float y = (randomGaussian()*.3) +y1 + (fraction * (finy-y1));
void drawPaper(int x, int y, int w, int h) {
for (int i = x; i< w + x-1; i+=2) {
for (int j = y; j< h + y-1; j+=2) {
fill(random (220, 255), 150);
for (int i = 0; i<30; i++) {
fill(random(150, 200), 150);
rect(random(x, x + w-2), random(y, y + h-2), random(1, 3), random(1, 3));