{"id":73034,"date":"2022-09-25T15:40:30","date_gmt":"2022-09-25T19:40:30","guid":{"rendered":"https:\/\/courses.ideate.cmu.edu\/15-104\/f2022\/?p=73034"},"modified":"2022-09-25T15:40:30","modified_gmt":"2022-09-25T19:40:30","slug":"project-4-string-art-6","status":"publish","type":"post","link":"https:\/\/courses.ideate.cmu.edu\/15-104\/f2022\/2022\/09\/25\/project-4-string-art-6\/","title":{"rendered":"project 4: string art"},"content":{"rendered":"<!DOCTYPE html PUBLIC \"-\/\/W3C\/\/DTD HTML 4.0 Transitional\/\/EN\" \"http:\/\/www.w3.org\/TR\/REC-html40\/loose.dtd\">\n<html><body><p>I made my piece about flowers. I used functions to be able to place flowers wherever I want on the canvas, although there are only two right now<\/p>\n\n\n\n<div class=\"wp-block-file\"><a class=\"p5_sketch_link\" data-width=\"400\" data-height=\"300\" id=\"wp-block-file--media-cba2a9ac-4b1f-4617-9233-01e46c4094f2\" href=\"https:\/\/courses.ideate.cmu.edu\/15-104\/f2022\/wp-content\/uploads\/2022\/09\/sketch-384.js\">flower string art<\/a><iframe src=\"https:\/\/courses.ideate.cmu.edu\/15-104\/f2022\/wp-content\/plugins\/p5-embedder\/p5_iframe.html\" class=\"p5_exampleFrame\" width=\"400\" height=\"300\"><\/iframe><pre class=\"language-javascript\"><code class=\"p5_editor language-javascript\">\/\/ isis berymon section D\nvar dx;\nvar dy;\nvar numLines;\n\n\nfunction setup() {\n    createCanvas(400, 300);\n    background(84, 111, 82); \/\/green\n}\n\nfunction draw() {\n    \/\/center flower\n    stroke(134, 190, 243); \/\/light blue\n    petal(150, 100, 250, 100, 200, 150);\n    petal(250, 100, 250, 200, 200, 150);\n    petal(250, 200, 150, 200, 200, 150);\n    petal(150, 100, 150, 200, 200, 150);\n    stroke(144, 115, 245); \/\/light purple\n    petal(125, 75, 175, 75, 200, 150);\n    petal(125, 75, 125, 125, 200, 150);\n    petal(225, 75, 275, 75, 200, 150);\n    petal(275, 75, 275, 125, 200, 150);\n    petal(275, 175, 275, 225, 200, 150);\n    petal(275, 225, 225, 225, 200, 150);\n    petal(175, 225, 125, 225, 200, 150);\n    petal(125, 225, 125, 175, 200, 150);\n    flowerCenter(200, 150);\n    \/\/right flower\n    stroke(134, 190, 243); \/\/light blue\n    petal(350, 0, 400, 50, 400, 0);\n    stroke(144, 115, 245); \/\/light purple\n    petal(300, -25, 350, 25, 400, 0);\n    petal(375, 50, 425, 75, 400, 0);\n    flowerCenter(400, 0);\n    noLoop();\n}\n\nfunction flowerCenter(x, y) {\n    stroke(245, 231, 115); \/\/light yellow\n    numLines = 50;\n    for(var i = 0; i &lt;= numLines; i++){\n        push();\n        translate(x, y);\n        rotate(radians(i*360\/numLines)) \/\/ draws lines in a circle\n        line(0, 0, 0, 25);\n        pop();\n    }\n}\n\nfunction petal(x1, y1, x2, y2, centerX, centerY) {\n    numLines = 10;\n    dx = (x2-x1)\/numLines;\n    dy = (y2-y1)\/numLines;\n    var drawX1 = x1;\n    var drawY1 = y1;\n    for(var i = 0; i &lt;= numLines; i++){\n        line(drawX1, drawY1, centerX, centerY); \/\/lines all come from center\n        drawX1 += dx;\n        drawY1 += dy;\n    }\n}<\/code><\/pre><\/div><\/body><\/html>\n","protected":false},"excerpt":{"rendered":"<p>I made my piece about flowers. I used functions to be able to place flowers wherever I want on the canvas, although there are only two right now flower string art \/\/ isis berymon section D var dx; var dy; var numLines; function setup() { createCanvas(400, 300); background(84, 111, 82); \/\/green } function draw() { &hellip; <a href=\"https:\/\/courses.ideate.cmu.edu\/15-104\/f2022\/2022\/09\/25\/project-4-string-art-6\/\" class=\"more-link\">Continue reading<span class=\"screen-reader-text\"> &#8220;project 4: string art&#8221;<\/span><\/a><\/p>\n","protected":false},"author":703,"featured_media":0,"comment_status":"open","ping_status":"closed","sticky":false,"template":"","format":"standard","meta":[],"categories":[102,58],"tags":[],"_links":{"self":[{"href":"https:\/\/courses.ideate.cmu.edu\/15-104\/f2022\/wp-json\/wp\/v2\/posts\/73034"}],"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\/703"}],"replies":[{"embeddable":true,"href":"https:\/\/courses.ideate.cmu.edu\/15-104\/f2022\/wp-json\/wp\/v2\/comments?post=73034"}],"version-history":[{"count":2,"href":"https:\/\/courses.ideate.cmu.edu\/15-104\/f2022\/wp-json\/wp\/v2\/posts\/73034\/revisions"}],"predecessor-version":[{"id":73037,"href":"https:\/\/courses.ideate.cmu.edu\/15-104\/f2022\/wp-json\/wp\/v2\/posts\/73034\/revisions\/73037"}],"wp:attachment":[{"href":"https:\/\/courses.ideate.cmu.edu\/15-104\/f2022\/wp-json\/wp\/v2\/media?parent=73034"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/courses.ideate.cmu.edu\/15-104\/f2022\/wp-json\/wp\/v2\/categories?post=73034"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/courses.ideate.cmu.edu\/15-104\/f2022\/wp-json\/wp\/v2\/tags?post=73034"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}