{"id":71879,"date":"2022-09-16T02:16:12","date_gmt":"2022-09-16T06:16:12","guid":{"rendered":"https:\/\/courses.ideate.cmu.edu\/15-104\/f2022\/?p=71879"},"modified":"2022-09-16T02:16:12","modified_gmt":"2022-09-16T06:16:12","slug":"project-03-dynamic-drawing","status":"publish","type":"post","link":"https:\/\/courses.ideate.cmu.edu\/15-104\/f2022\/2022\/09\/16\/project-03-dynamic-drawing\/","title":{"rendered":"Project-03-Dynamic-Drawing"},"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>TIME 2 PARTY!<\/p>\n\n\n\n<div><a class=\"p5_sketch_link\" href=\"https:\/\/courses.ideate.cmu.edu\/15-104\/f2022\/wp-content\/uploads\/2022\/09\/sketch-264.js\" data-width=\"500\" data-height=\"500\">sketch<\/a>\n\n\n\n<p><\/p><iframe src=\"https:\/\/courses.ideate.cmu.edu\/15-104\/f2022\/wp-content\/plugins\/p5-embedder\/p5_iframe.html\" class=\"p5_exampleFrame\" width=\"500\" height=\"500\"><\/iframe><pre class=\"language-javascript\"><code class=\"p5_editor language-javascript\">\/\/ Zoe Lin (ID: youlin)\n\/\/ Section B\n\nvar x, y, r, g, b, rad;\n\nfunction setup() {\n  createCanvas(500, 500);\n  noStroke();\n  rectMode(CENTER);\n}\n\nfunction draw() {\n  background(random(0, 15));\n  \n  \/\/party lights!!!\n  push();\n  blendMode(SCREEN);\n  r = random(255); \/\/randomizes color\n  g = random(50);\n  b = random(255);\n  x = random(width); \/\/randomizes where lights spawn\n  y = random(height);\n  rad = random(2, 50); \/\/randomizes size of circle\n  noStroke();\n  fill(r, g, b, random(75, 125)); \/\/sets a random transparency\n  circle(x, y, rad); \/\/spawns a circle anywhere on canvas\n  circle(mouseX, mouseY, rad*2); \/\/spawns lights where the cursor is\n  pop();\n  \n  let r1 = map(mouseX, 0, height\/2, 0, width\/2); \/\/tracks horizontal location of mouse\n  let r2 = width - r1;\n  \n  let up = map(mouseY, 0, height, 0, width); \/\/ tracks vertical location of mouse\n  let down = height - up; \/\/the other way\n\n  \/\/circle1\n  let circle1X = width \/ 3 + r2 * 0.75 \/\/x position of circle 1\n  let circle1Y = height \/ 3 - r2 \/ 3.5 \/\/y position of circle 1\n  let circle1Mouth = up\/4 \/\/mouth location of circle 1\n  \n  \/\/body\n  noStroke();\n  fill(up\/3,r1\/3,down\/3,r2\/3);\n  ellipse(circle1X, circle1Y, down, r2); \/\/fluid body\n  \n  \/\/eye\n  fill(0, r2);\n  circle(circle1X - up\/4, circle1Y - r2\/10 , down\/20);\n  \n  \/\/eye\n  fill(0, r2);\n  circle(circle1X + up\/4, circle1Y - r2\/10 , up\/12);\n  \n  \/\/mouth\n  noFill();\n  stroke(0, r2);\n  strokeWeight(4);\n  arc(circle1X, circle1Y + r2\/12, circle1Mouth, circle1Mouth, TWO_PI, PI);\n\n  \/\/circle2\n  let circle2X = width \/ 2\n  let circle2Y = height \/ 2 + down \/ 2\n  let circle2Mouth = down\/4\n  \n  noStroke();\n  fill(r2\/3,up\/3,r1\/3,down\/3);\n  ellipse(circle2X, circle2Y,  down*1.25, up*1.5);\n  \n  fill(0, r2)\n  circle(circle2X - r2\/4, circle2Y - down\/10 , up\/8);\n  \n  fill(0, r2)\n  circle(circle2X + r2\/4, circle2Y - down\/10 , down\/8);\n  \n  noFill();\n  stroke(0, r2);\n  strokeWeight(4);\n  arc(circle2X, circle2Y + r2\/20, circle2Mouth, circle2Mouth, TWO_PI, PI);\n  \n  \/\/circle3\n  let circle3X = width \/ 1.5 + r2 \/ 2\n  let circle3Y = height \/ 2\n  let circle3Mouth = down\/10\n  \n  noStroke();\n  fill(down\/3,r2\/3,up\/3,r1\/3);\n  ellipse(circle3X, circle3Y, r2*1.5, r2*1.5);\n  \n  fill(0, r2)\n  circle(circle3X - r2\/4, circle3Y - r2\/10 , r2\/8);\n  \n  fill(0, r2)\n  circle(circle3X + r2\/4, circle3Y - up\/10 , r2\/8);\n  \n  noFill();\n  stroke(0,r2 );\n  strokeWeight(4);\n  arc(circle3X, circle3Y + r2\/12, circle3Mouth, circle3Mouth, TWO_PI, PI);\n  \n  \/\/circle4\n  let circle4X = width \/ 1.5 - r1\/1.7\n  let circle4Y = height \/ 4 + r2\/4\n  let circle4Mouth = down\/10\n  \n  noStroke();\n  fill(r1\/3,down\/3,r2\/3,up\/2.5);\n  ellipse(circle4X, circle4Y, r1*1.25, down);\n  \n  fill(0, r2)\n  circle(circle4X - r1\/4, circle4Y - r2\/15 , r1\/8);\n  \n  fill(0, r2)\n  circle(circle4X + r1\/4, circle4Y - r1\/10 , r1\/8);\n  \n  noFill();\n  stroke(0,r2);\n  strokeWeight(4);\n  arc(circle4X, circle4Y + r1\/10, circle4Mouth, circle4Mouth, TWO_PI, PI);\n  \n  \/\/circle5\n  let circle5X = width \/ 3 - r2 \/ 1.5\n  let circle5Y = height \/ 2.5\n  let circle5Mouth = r2\/4\n  \n  noStroke();\n  fill(down\/3,r2\/2,r1\/2,r2\/3);\n  ellipse(circle5X\/1.5, circle5Y\/2, up, up*1.25);\n  \n  fill(0, r2)\n  circle(circle5X - up\/4, circle5Y - up\/3 , r1\/8);\n  \n  fill(0, r2)\n  circle(circle5X + r1\/4, circle5Y - r1\/3 , r1\/8);\n  \n  noFill();\n  stroke(0,r2);\n  strokeWeight(4);\n  arc(circle5X, circle5Y + r1\/20, circle5Mouth, circle5Mouth, TWO_PI, PI);\n  \n  \/\/circle6\n  let circle6X = width \/ 5 + r1 \/ 2.5\n  let circle6Y = height - 10\n  let circle6Mouth = r1\/5\n  \n  noStroke();\n  fill(r2\/3,up\/4,r2\/2,up\/3);\n  ellipse(circle6X, circle6Y, up*0.6, down*1.2);  \n  \n  fill(0, r2)\n  circle(circle6X - up\/5, circle6Y - up\/10 , r1\/10);\n  \n  fill(0, r2)\n  circle(circle6X + r1\/7, circle6Y - r1\/10 , r1\/10);\n  \n  noFill();\n  stroke(0,r2);\n  strokeWeight(4);\n  arc(circle6X, circle6Y + r1\/10, circle6Mouth, circle6Mouth, TWO_PI, PI);\n \n  \/\/circ7\n  let circle7X = width - 10\n  let circle7Y = height \/ 2 - up\n  let circle7Mouth = up\/4\n  \n  noStroke();\n  fill(up\/3,r1\/4,down\/2,r2\/3);\n  ellipse(circle7X, circle7Y, down*0.5, up);\n  \n  fill(0, r2)\n  circle(circle7X - up\/4, circle7Y - up\/10, r1\/8);\n  \n  fill(0, r2)\n  circle(circle7X + r1\/4, circle7Y - r1\/10 , r1\/8);\n  \n  noFill();\n  stroke(0,r2);\n  strokeWeight(4);\n  arc(circle7X, circle7Y+r1\/20, circle7Mouth, circle7Mouth, TWO_PI, PI);\n}<\/code><\/pre><\/div><\/body><\/html>\n","protected":false},"excerpt":{"rendered":"<p>TIME 2 PARTY! sketch \/\/ Zoe Lin (ID: youlin) \/\/ Section B var x, y, r, g, b, rad; function setup() { createCanvas(500, 500); noStroke(); rectMode(CENTER); } function draw() { background(random(0, 15)); \/\/party lights!!! push(); blendMode(SCREEN); r = random(255); \/\/randomizes color g = random(50); b = random(255); x = random(width); \/\/randomizes where lights spawn y &hellip; <a href=\"https:\/\/courses.ideate.cmu.edu\/15-104\/f2022\/2022\/09\/16\/project-03-dynamic-drawing\/\" class=\"more-link\">Continue reading<span class=\"screen-reader-text\"> &#8220;Project-03-Dynamic-Drawing&#8221;<\/span><\/a><\/p>\n","protected":false},"author":740,"featured_media":0,"comment_status":"open","ping_status":"closed","sticky":false,"template":"","format":"standard","meta":[],"categories":[100,56],"tags":[],"_links":{"self":[{"href":"https:\/\/courses.ideate.cmu.edu\/15-104\/f2022\/wp-json\/wp\/v2\/posts\/71879"}],"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\/740"}],"replies":[{"embeddable":true,"href":"https:\/\/courses.ideate.cmu.edu\/15-104\/f2022\/wp-json\/wp\/v2\/comments?post=71879"}],"version-history":[{"count":1,"href":"https:\/\/courses.ideate.cmu.edu\/15-104\/f2022\/wp-json\/wp\/v2\/posts\/71879\/revisions"}],"predecessor-version":[{"id":71882,"href":"https:\/\/courses.ideate.cmu.edu\/15-104\/f2022\/wp-json\/wp\/v2\/posts\/71879\/revisions\/71882"}],"wp:attachment":[{"href":"https:\/\/courses.ideate.cmu.edu\/15-104\/f2022\/wp-json\/wp\/v2\/media?parent=71879"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/courses.ideate.cmu.edu\/15-104\/f2022\/wp-json\/wp\/v2\/categories?post=71879"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/courses.ideate.cmu.edu\/15-104\/f2022\/wp-json\/wp\/v2\/tags?post=71879"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}