{"id":73637,"date":"2022-10-01T23:26:10","date_gmt":"2022-10-02T03:26:10","guid":{"rendered":"https:\/\/courses.ideate.cmu.edu\/15-104\/f2022\/?p=73637"},"modified":"2022-10-01T23:28:35","modified_gmt":"2022-10-02T03:28:35","slug":"wallpaper-fabric","status":"publish","type":"post","link":"https:\/\/courses.ideate.cmu.edu\/15-104\/f2022\/2022\/10\/01\/wallpaper-fabric\/","title":{"rendered":"Wallpaper\/fabric"},"content":{"rendered":"<!DOCTYPE html PUBLIC \"-\/\/W3C\/\/DTD HTML 4.0 Transitional\/\/EN\" \"http:\/\/www.w3.org\/TR\/REC-html40\/loose.dtd\">\n<html><body><div class=\"wp-block-file\"><a class=\"p5_sketch_link\" data-width=\"620\" data-height=\"600\" id=\"wp-block-file--media-88790515-3f21-460c-9f4a-b7d396cc0362\" href=\"https:\/\/courses.ideate.cmu.edu\/15-104\/f2022\/wp-content\/uploads\/2022\/10\/sketch-36.js\">fabric sketch<\/a><iframe src=\"https:\/\/courses.ideate.cmu.edu\/15-104\/f2022\/wp-content\/plugins\/p5-embedder\/p5_iframe.html\" class=\"p5_exampleFrame\" width=\"620\" height=\"600\"><\/iframe><pre class=\"language-javascript\"><code class=\"p5_editor language-javascript\">function setup() {\n    createCanvas(620, 600);\n    background('skyblue');\n}\n\nfunction draw() {\n    \/\/blue patches\n    for(let x=10; x&lt;width; x+=240){\n        for(let y=0; y&lt;height; y+=240){\n            patch(x,y);\n        }\n    }\n\n    \/\/other blue lol\n    for(let x=130; x&lt;width; x+=240){\n        for(let y=120; y&lt;height; y+=240){\n            patchtw(x,y);\n        }\n    }\n\n    \/\/pig moving etc\n    for(let x=70; x&lt;width; x+=120){\n        for(let y=50; y&lt;height-50; y+= 120){\n            pigg(x, y);       \n        }\n    }\n\n    \/\/rows of stitch up and down\n    for(let x=10; x&lt;width; x+=120){\n        for(let y = 10; y&lt;height; y+=20){\n            cross(x, y);\n        }\n    }\n\n    \/\/row of stitch across\n    for(let y =120; y&lt;height; y+=120){\n        for(let x=10; x&lt;width; x+=20){\n        cross(x,y);\n        }\n    }\n\n}\n\n\n\nfunction pigg (x, y){\n    strokeWeight(1);\n    stroke('black');\n    fill('pink');\n    \/\/legs\n    rect(x - 30, y, 10, 60);\n    rect(x + 20, y, 10, 60);\n    \/\/bod\n    ellipse(x, y, 100, 80);\n    \/\/ears\n    triangle(x-10, y-20, x-20, y-15, x-20, y-30);\n    triangle(x+10, y-20, x+20, y-15, x+20, y-30);\n    \/\/head\n    ellipse(x, y, 50);\n    \/\/snout\n    push();\n    fill('plum');\n    ellipse(x, y+10, 20, 10); \n    pop();\n    \/\/eyes\n    push();\n    fill('black');\n    ellipse(x-10, y-5, 5);\n    ellipse(x+10, y-5, 5);\n    \/\/nose hole\n    ellipse(x-5, y+10, 2);\n    ellipse(x+5, y+10, 2); \n    pop(); \n \n}\n\n\nfunction cross(x,y){\n    strokeWeight(1);\n    stroke('yellow');\n    line(x-10, y-10, x+10, y+10);\n    line(x-10, y+10, x+10, y-10);\n}\n\nfunction patch(x,y){\n    noStroke();\n    fill('darkcyan');\n    rect(x, y, 120, 120);\n}\n\nfunction patchtw(x,y){\n    noStroke();\n    fill('lightseagreen');\n    rect(x, y, 120, 120);\n}<\/code><\/pre><\/div><\/body><\/html>\n","protected":false},"excerpt":{"rendered":"<p>fabric sketch function setup() { createCanvas(620, 600); background(&#8216;skyblue&#8217;); } function draw() { \/\/blue patches for(let x=10; x&lt;width; x+=240){ for(let y=0; y&lt;height; y+=240){ patch(x,y); } } \/\/other blue lol for(let x=130; x&lt;width; x+=240){ for(let y=120; y&lt;height; y+=240){ patchtw(x,y); } } \/\/pig moving etc for(let x=70; x&lt;width; x+=120){ for(let y=50; y&lt;height-50; y+= 120){ pigg(x, y); } } &hellip; <a href=\"https:\/\/courses.ideate.cmu.edu\/15-104\/f2022\/2022\/10\/01\/wallpaper-fabric\/\" class=\"more-link\">Continue reading<span class=\"screen-reader-text\"> &#8220;Wallpaper\/fabric&#8221;<\/span><\/a><\/p>\n","protected":false},"author":747,"featured_media":0,"comment_status":"open","ping_status":"closed","sticky":false,"template":"","format":"standard","meta":[],"categories":[104,58],"tags":[],"_links":{"self":[{"href":"https:\/\/courses.ideate.cmu.edu\/15-104\/f2022\/wp-json\/wp\/v2\/posts\/73637"}],"collection":[{"href":"https:\/\/courses.ideate.cmu.edu\/15-104\/f2022\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/courses.ideate.cmu.edu\/15-104\/f2022\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/courses.ideate.cmu.edu\/15-104\/f2022\/wp-json\/wp\/v2\/users\/747"}],"replies":[{"embeddable":true,"href":"https:\/\/courses.ideate.cmu.edu\/15-104\/f2022\/wp-json\/wp\/v2\/comments?post=73637"}],"version-history":[{"count":4,"href":"https:\/\/courses.ideate.cmu.edu\/15-104\/f2022\/wp-json\/wp\/v2\/posts\/73637\/revisions"}],"predecessor-version":[{"id":73644,"href":"https:\/\/courses.ideate.cmu.edu\/15-104\/f2022\/wp-json\/wp\/v2\/posts\/73637\/revisions\/73644"}],"wp:attachment":[{"href":"https:\/\/courses.ideate.cmu.edu\/15-104\/f2022\/wp-json\/wp\/v2\/media?parent=73637"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/courses.ideate.cmu.edu\/15-104\/f2022\/wp-json\/wp\/v2\/categories?post=73637"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/courses.ideate.cmu.edu\/15-104\/f2022\/wp-json\/wp\/v2\/tags?post=73637"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}