{"id":193,"date":"2011-11-10T00:39:10","date_gmt":"2011-11-10T08:39:10","guid":{"rendered":"http:\/\/new.joyofprocessing.com\/blog\/?p=193"},"modified":"2011-11-10T00:39:10","modified_gmt":"2011-11-10T08:39:10","slug":"matt-pearsons-generative-art","status":"publish","type":"post","link":"https:\/\/joyofprocessing.com\/blog\/2011\/11\/matt-pearsons-generative-art\/","title":{"rendered":"Matt Pearson&#8217;s Generative Art"},"content":{"rendered":"<p><a href=\"http:\/\/www.amazon.com\/exec\/obidos\/ASIN\/1935182625\/krazydad-20\"><img decoding=\"async\" src=\"http:\/\/ecx.images-amazon.com\/images\/I\/41O%2BAuvUpGL._BO2,204,203,200_PIsitb,TopRight,35,-76_AA300_SH20_OU01_.jpg\" \/><\/a><br \/>\nOne of the great new Processing books to come out this year is Matt Pearson&#8217;s <a href=\"http:\/\/www.amazon.com\/exec\/obidos\/ASIN\/1935182625\/krazydad-20\">Generative Art<\/a>.  Pearson has a collection of great Processing sketches at his website <a href=\"http:\/\/abandonedart.org\/\">AbandonedArt.org<\/a>.  He also blogs at <a href=\"www.zenbullets.com\">ZenBullets.com<\/a><\/p>\n<p>Like a lot of generative artists, Pearson is really fond of skinny lines, and does a lot of sketches that involve layering lots of skinny lines (and curves) on top of each other, to build dense interesting textures.  Here&#8217;s one of his early sketches, <a href=\"http:\/\/abandonedart.org\/?p=16\"><i>Triptych<\/i><\/a>.<\/p>\n<p><script type=\"application\/processing\">\/\/ Sept 2008 \n\/\/ http:\/\/www.abandonedart.org\n\/\/ http:\/\/www.zenbullets.com\n\/\/\n\/\/ This work is licensed under a Creative Commons 3.0 License.\n\/\/ (Attribution - NonCommerical - ShareAlike)\n\/\/ http:\/\/creativecommons.org\/licenses\/by-nc-sa\/3.0\/\n\/\/ \n\/\/ This basically means, you are free to use it as long as you:\n\/\/ 1. give http:\/\/www.zenbullets.com a credit\n\/\/ 2. don't use it for commercial gain\n\/\/ 3. share anything you create with it in the same way I have\n\/\/\n\/\/ These conditions can be waived if you want to do something groovy with it \n\/\/ though, so feel free to email me via http:\/\/www.zenbullets.com\n\n\n\/\/================================= global vars\n\nint nextNum = 1;   \/\/ keeps track fo current figure\nfloat xstart1, xstart2, xstart3;\n\n\/\/================================= init\n\nvoid setup() {\n  size(500,300);\n  frameRate(60);\n  smooth();\n  clearBackground();\n  xstart1 = 1 * width\/4;\n  xstart2 = 2 * width\/4;\n  xstart3 = 3 * width\/4;\n  create();\n  create();\n  create();\n}\n\nvoid create() {\n  float x1, x2, y1, y2;\n  stroke(140, 120, 60, 200);\n  strokeWeight(1);\n  \n  float xpos = xstart1;\n  if (nextNum == 2) {\n    xpos = xstart2;\n  } else if (nextNum == 3) {\n    xpos = xstart3;\n  } \n  \n  int ytop = 20;\n  int ybottom = height - 20;\n  \n  float step = 5 + (random(4) - 4);\n  \n  \/\/ straight line\n  x1 = xpos;\n  y1 = ytop;\n  for (float y = ytop; y < ybottom; y+= step) {\n    y2 = y;\n    x2 = x1 + (random(1) - 0.5);\n    \n    \/\/ draw line to it\n    line(x1, y1, x2, y2);\n    x1 = x2; y1 = y2;\n  }\n  \n  if (x1 > width) { \n    x1 = 0; \n  } else if (x1 < 0) {\n    x1 = width;\n  } \n  if (nextNum == 1) {\n    xstart1 = x1;\n  } else if (nextNum == 2) {\n    xstart2 = x1;\n  } else if (nextNum == 3) {\n    xstart3 = x1;\n  } \n  \n  \/\/ spiral noise\n  spiralScratch(xpos, random(ybottom) + ytop);\n  \n  \n  \/\/ move to next figure for next drawing\n  nextNum++;\n  if (nextNum > 3) { nextNum = 1; }\n}\n\n\nvoid spiralScratch(float xpos, float ypos) {\n  float x1, x2, y1, y2;\n  float step = 5 + (random(4) - 4);\n  strokeWeight(1);\n  stroke(200, 160, 60, 70);\n  float radius = 5;\n  float rad = radians(90);\n  x1 = xpos;\n  y1 = ypos;\n  for (int x = 0; x < (360 * 4); x+= step) {\n    radius += (1 + (random(4) - 2));\n    \n    rad = radians(x + step);\n    x2 = xpos + (radius * cos(rad))  + (random(4) - 2);\n    y2 = ypos + (radius * sin(rad))  + (random(4) - 2);\n    \/\/ draw line to it\n   line(x1, y1, x2, y2);\n   x1 = x2; y1 = y2;\n  } \n}\n\n\nvoid clearBackground() {\n  background(255);\n  \/\/ graph paper\n  int gap = 10;\n  strokeWeight(1);\n  stroke(140, 40);\n  for (int x=0;x<width;x+=gap) {\n     line(x, 0, x, height);\n  }\n  for (int y=0;y<height;y+=gap) {\n    line(0, y, width, y);\n  } \n}\n\n\/\/================================= frame loop\n\nvoid draw() {\n  \/\/ clearBackground();\n  create();\n}\n\n\/\/================================= interaction\n\nvoid mousePressed() { \n  clearBackground();\n  \/\/ create();\n  xstart1 = 1 * width\/4;\n  xstart2 = 2 * width\/4;\n  xstart3 = 3 * width\/4;\n}\n\n\/\/================================= objects\n\n<\/script><\/p>\n<p>\n","protected":false},"excerpt":{"rendered":"<p>One of the great new Processing books to come out this year is Matt Pearson&#8217;s Generative Art. Pearson has a collection of great Processing sketches at his website AbandonedArt.org. He also blogs at ZenBullets.com Like a lot of generative artists, Pearson is really fond of skinny lines, and does a lot of sketches that involve [&hellip;]<\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"open","ping_status":"closed","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[1],"tags":[],"class_list":["post-193","post","type-post","status-publish","format-standard","hentry","category-uncategorized"],"_links":{"self":[{"href":"https:\/\/joyofprocessing.com\/blog\/wp-json\/wp\/v2\/posts\/193","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/joyofprocessing.com\/blog\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/joyofprocessing.com\/blog\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/joyofprocessing.com\/blog\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/joyofprocessing.com\/blog\/wp-json\/wp\/v2\/comments?post=193"}],"version-history":[{"count":8,"href":"https:\/\/joyofprocessing.com\/blog\/wp-json\/wp\/v2\/posts\/193\/revisions"}],"predecessor-version":[{"id":201,"href":"https:\/\/joyofprocessing.com\/blog\/wp-json\/wp\/v2\/posts\/193\/revisions\/201"}],"wp:attachment":[{"href":"https:\/\/joyofprocessing.com\/blog\/wp-json\/wp\/v2\/media?parent=193"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/joyofprocessing.com\/blog\/wp-json\/wp\/v2\/categories?post=193"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/joyofprocessing.com\/blog\/wp-json\/wp\/v2\/tags?post=193"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}