{"id":2965,"date":"2016-09-10T16:20:55","date_gmt":"2016-09-10T15:20:55","guid":{"rendered":"http:\/\/www.lyceelecorbusier.eu\/p5js\/?p=2965"},"modified":"2016-09-11T07:47:51","modified_gmt":"2016-09-11T06:47:51","slug":"p5-re-code-13-2","status":"publish","type":"post","link":"https:\/\/www.lyceelecorbusier.eu\/p5js\/?p=2965","title":{"rendered":"\/ p5 \/ re-code 14"},"content":{"rendered":"<p>Inspir\u00e9 par <a href=\"http:\/\/www.lyceelecorbusier.eu\/p5\/recode\/COMPUTER_GRAPHICS_AND_ART_Nov1978.pdf\" target=\"_blank\">Computer Graphics and Art vol3 n\u00b04<\/a>,\u00a04<sup>e<\/sup> de couverture, &#8220;Hex Variations&#8221; de\u00a0<a href=\"http:\/\/dada.compart-bremen.de\/item\/agent\/644\" target=\"_blank\">William Kolomyjec<\/a><\/p>\n\n<!-- iframe plugin v.5.1 wordpress.org\/plugins\/iframe\/ -->\n<iframe src=\"http:\/\/lyceelecorbusier.eu\/p5\/recode\/014-recode\" width=\"780\" height=\"780\" style=\"border: 1px solid #ddd;\" scrolling=\"yes\" class=\"iframe-class\" frameborder=\"0\"><\/iframe>\n\n<p>&nbsp;<\/p>\n<pre>\/\/ This sketch is part of the ReCode Project - http:\/\/recodeproject.com\r\n\/\/ From Computer Graphics and Art vol3 no4 Back Cover\r\n\/\/ by William Kolomyjec\r\n\/\/ \"Hex Variations\"\r\n\/\/ \r\n\/\/ Steve Berrick\r\n\/\/ 2012\r\n\/\/ Creative Commons license CC BY-SA 3.0\r\n\r\nvar _width = 600;\r\nvar _height = 900;\r\nvar _size = 20; \/\/ hexagon radius\r\n\r\nfunction setup() {\r\n \r\n createCanvas(_width, _height);\r\n noLoop();\r\n \r\n background(255);\r\n noFill();\r\n stroke(0);\r\n strokeWeight(2);\r\n\r\n}\r\n\r\nfunction draw() {\r\n\r\n \/\/ clear background\r\n background(255);\r\n \r\n \/\/ line length (hypotenuse)\r\n var h = sin(PI\/3) * _size;\r\n \r\n for (var i = 0; i &lt;= _width \/ (_size * 3); i++) {\r\n for (var j = 0; j &lt;= (_height \/ h) + 1; j++) {\r\n\r\n \/\/ reference points (centre of each hexagon)\r\n var x = i * _size * 3 + (_size \/ 2);\r\n var y = j * h;\r\n \/\/ offset each odd row\r\n if (j % 2 &gt; 0) {\r\n x += _size * 1.5;\r\n }\r\n\r\n push();\r\n \r\n translate(x, y);\r\n \r\n \/\/ random hexagon 'rotation' (0, 120, 240 degrees)\r\n rotate(int(random(0, 3)) * PI\/3);\r\n \r\n \/\/ draw line\r\n line(0, -h, 0, h);\r\n \r\n \/\/ draw arcs\r\n arc(-_size, 0, _size, _size, -PI\/3, PI\/3);\r\n arc( _size, 0, _size, _size, PI\/3 * 2, PI\/3 * 4); \r\n \r\n pop();\r\n\r\n } \r\n }\r\n\r\n}\r\n\r\nfunction mousePressed() {\r\n \r\n redraw();\r\n\r\n}<\/pre>\n","protected":false},"excerpt":{"rendered":"<p>Inspir\u00e9 par Computer Graphics and Art vol3 n\u00b04,\u00a04e de couverture, &#8220;Hex Variations&#8221; de\u00a0William Kolomyjec &nbsp; \/\/ This sketch is part of the ReCode Project &#8211; http:\/\/recodeproject.com \/\/ From Computer Graphics and Art vol3 no4 Back Cover \/\/ by&#8230; <a class=\"read-more\" href=\"https:\/\/www.lyceelecorbusier.eu\/p5js\/?p=2965\">Lire la suite&#8230;<\/a><\/p>\n","protected":false},"author":1,"featured_media":2966,"comment_status":"closed","ping_status":"closed","sticky":false,"template":"","format":"standard","meta":[],"categories":[9,6],"tags":[],"_links":{"self":[{"href":"https:\/\/www.lyceelecorbusier.eu\/p5js\/index.php?rest_route=\/wp\/v2\/posts\/2965"}],"collection":[{"href":"https:\/\/www.lyceelecorbusier.eu\/p5js\/index.php?rest_route=\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/www.lyceelecorbusier.eu\/p5js\/index.php?rest_route=\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/www.lyceelecorbusier.eu\/p5js\/index.php?rest_route=\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/www.lyceelecorbusier.eu\/p5js\/index.php?rest_route=%2Fwp%2Fv2%2Fcomments&post=2965"}],"version-history":[{"count":3,"href":"https:\/\/www.lyceelecorbusier.eu\/p5js\/index.php?rest_route=\/wp\/v2\/posts\/2965\/revisions"}],"predecessor-version":[{"id":2969,"href":"https:\/\/www.lyceelecorbusier.eu\/p5js\/index.php?rest_route=\/wp\/v2\/posts\/2965\/revisions\/2969"}],"wp:featuredmedia":[{"embeddable":true,"href":"https:\/\/www.lyceelecorbusier.eu\/p5js\/index.php?rest_route=\/wp\/v2\/media\/2966"}],"wp:attachment":[{"href":"https:\/\/www.lyceelecorbusier.eu\/p5js\/index.php?rest_route=%2Fwp%2Fv2%2Fmedia&parent=2965"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/www.lyceelecorbusier.eu\/p5js\/index.php?rest_route=%2Fwp%2Fv2%2Fcategories&post=2965"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/www.lyceelecorbusier.eu\/p5js\/index.php?rest_route=%2Fwp%2Fv2%2Ftags&post=2965"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}