{"id":75164,"date":"2022-11-05T18:26:57","date_gmt":"2022-11-05T22:26:57","guid":{"rendered":"https:\/\/courses.ideate.cmu.edu\/15-104\/f2022\/?p=75164"},"modified":"2022-11-05T20:00:51","modified_gmt":"2022-11-06T00:00:51","slug":"project-9","status":"publish","type":"post","link":"https:\/\/courses.ideate.cmu.edu\/15-104\/f2022\/2022\/11\/05\/project-9\/","title":{"rendered":"Project 9"},"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>This project is fun to create. I decided to use little hearts to paint a portrait. To paint: press the mouse and drag. You can change to a smaller brush size by holding any key.<\/p><div><a class=\"p5_sketch_link\" href=\"https:\/\/courses.ideate.cmu.edu\/15-104\/f2022\/wp-content\/uploads\/2022\/11\/sketch-14.js\" data-width=\"480\" data-height='480\"'>sketch<\/a>\n\n\n\n<figure class=\"wp-block-image size-full is-resized\"><img loading=\"lazy\" src=\"https:\/\/courses.ideate.cmu.edu\/15-104\/f2022\/wp-content\/uploads\/2022\/11\/Screen-Shot-2022-11-05-at-6.02.32-PM.png\" alt=\"\" class=\"wp-image-75165\" width=\"154\" height=\"156\" srcset=\"https:\/\/courses.ideate.cmu.edu\/15-104\/f2022\/wp-content\/uploads\/2022\/11\/Screen-Shot-2022-11-05-at-6.02.32-PM.png 466w, https:\/\/courses.ideate.cmu.edu\/15-104\/f2022\/wp-content\/uploads\/2022\/11\/Screen-Shot-2022-11-05-at-6.02.32-PM-295x300.png 295w\" sizes=\"(max-width: 154px) 85vw, 154px\"><figcaption>it will take you a few minutes to paint. This is a combination of smaller hearts and bigger hearts.<\/figcaption><\/figure><figure class=\"wp-block-image size-full is-resized\"><img loading=\"lazy\" src=\"https:\/\/courses.ideate.cmu.edu\/15-104\/f2022\/wp-content\/uploads\/2022\/11\/jens-photo.jpg\" alt=\"\" class=\"wp-image-75225\" width=\"154\" height=\"154\" srcset=\"https:\/\/courses.ideate.cmu.edu\/15-104\/f2022\/wp-content\/uploads\/2022\/11\/jens-photo.jpg 480w, https:\/\/courses.ideate.cmu.edu\/15-104\/f2022\/wp-content\/uploads\/2022\/11\/jens-photo-300x300.jpg 300w, https:\/\/courses.ideate.cmu.edu\/15-104\/f2022\/wp-content\/uploads\/2022\/11\/jens-photo-150x150.jpg 150w\" sizes=\"(max-width: 154px) 85vw, 154px\"><\/figure><iframe src=\"https:\/\/courses.ideate.cmu.edu\/15-104\/f2022\/wp-content\/plugins\/p5-embedder\/p5_iframe.html\" class=\"p5_exampleFrame\" width=\"480\" height='480\"'><\/iframe><pre class=\"language-javascript\"><code class=\"p5_editor language-javascript\">\/\/Jenny Wang\n\/\/Section B\n\/\/jiayiw3@andrew.cmu.edu\n\/\/Project 09\n\nvar img;\n\nfunction preload(){\n    img = loadImage(\"https:\/\/i.imgur.com\/MBJZ7t1.jpg\");\n}\n\nfunction setup() {\n    createCanvas(480, 480);\n    imageMode(CENTER);\n    noStroke();\n    background(\"orange\");\n    frameRate(50);\n}\n\nfunction heart(x, y, size) {\n  beginShape();\n  vertex(x, y);\n  bezierVertex(x - size \/ 2, y - size \/ 2, x - size, y + size \/ 3, x, y + size);\n  bezierVertex(x + size, y + size \/ 3, x + size \/ 2, y - size \/ 2, x, y);\n  endShape(CLOSE);\n}\n\nfunction draw() {\n    \n    \/\/area radius for random pixels\n    var xPosition = random(-5,5);\n    var yPosition = random(-5,5);\n\n    \/\/set area for mouse\n    var x = map(mouseX,0,width,0,1200); \n    var y = map(mouseY,0,height,0,1500); \n\n    \/\/get the size of the pixel\n    var pixelSize;\n\n    \/\/get the color of the pixel\n    var pixC = img.get(x,y);\n    \n\n    \/\/set to paint with mouse\n    if(mouseIsPressed){\n        push();\n        translate(mouseX,mouseY);\n        fill(pixC);\n\n        \/\/set heart shaped brush with different sizes\n        if(keyIsPressed){\n            pixelSize = random(4,8);\n        }\n        else{\n            pixelSize = random(10,22);\n        }\n        heart(xPosition,yPosition,pixelSize);\n        pop();\n    }\n}\n    \n<\/code><\/pre><\/div><\/body><\/html>\n","protected":false},"excerpt":{"rendered":"<p>This project is fun to create. I decided to use little hearts to paint a portrait. To paint: press the mouse and drag. You can change to a smaller brush size by holding any key. sketch \/\/Jenny Wang \/\/Section B \/\/jiayiw3@andrew.cmu.edu \/\/Project 09 var img; function preload(){ img = loadImage(&#8220;https:\/\/i.imgur.com\/MBJZ7t1.jpg&#8221;); } function setup() { createCanvas(480, &hellip; <a href=\"https:\/\/courses.ideate.cmu.edu\/15-104\/f2022\/2022\/11\/05\/project-9\/\" class=\"more-link\">Continue reading<span class=\"screen-reader-text\"> &#8220;Project 9&#8221;<\/span><\/a><\/p>\n","protected":false},"author":769,"featured_media":0,"comment_status":"open","ping_status":"closed","sticky":false,"template":"","format":"standard","meta":[],"categories":[111,56],"tags":[],"_links":{"self":[{"href":"https:\/\/courses.ideate.cmu.edu\/15-104\/f2022\/wp-json\/wp\/v2\/posts\/75164"}],"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\/769"}],"replies":[{"embeddable":true,"href":"https:\/\/courses.ideate.cmu.edu\/15-104\/f2022\/wp-json\/wp\/v2\/comments?post=75164"}],"version-history":[{"count":5,"href":"https:\/\/courses.ideate.cmu.edu\/15-104\/f2022\/wp-json\/wp\/v2\/posts\/75164\/revisions"}],"predecessor-version":[{"id":75228,"href":"https:\/\/courses.ideate.cmu.edu\/15-104\/f2022\/wp-json\/wp\/v2\/posts\/75164\/revisions\/75228"}],"wp:attachment":[{"href":"https:\/\/courses.ideate.cmu.edu\/15-104\/f2022\/wp-json\/wp\/v2\/media?parent=75164"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/courses.ideate.cmu.edu\/15-104\/f2022\/wp-json\/wp\/v2\/categories?post=75164"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/courses.ideate.cmu.edu\/15-104\/f2022\/wp-json\/wp\/v2\/tags?post=75164"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}