{"id":71511,"date":"2022-09-11T10:54:17","date_gmt":"2022-09-11T14:54:17","guid":{"rendered":"https:\/\/courses.ideate.cmu.edu\/15-104\/f2022\/?p=71511"},"modified":"2022-09-17T19:27:51","modified_gmt":"2022-09-17T23:27:51","slug":"project-2","status":"publish","type":"post","link":"https:\/\/courses.ideate.cmu.edu\/15-104\/f2022\/2022\/09\/11\/project-2\/","title":{"rendered":"Project 2"},"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>project 2<\/p>\n<div><a class=\"p5_sketch_link\" href=\"https:\/\/courses.ideate.cmu.edu\/15-104\/f2022\/wp-content\/uploads\/2022\/09\/sketch-223.js\" data-width=\"600\" data-height=\"450\">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=\"600\" height=\"450\"><\/iframe><pre class=\"language-javascript\"><code class=\"p5_editor language-javascript\">var eyeSize = 20;\nvar faceWidth = 300;\nvar faceHeight = 250;\nvar counter = 1;\nvar hatH = faceHeight\/1.5;\nvar bodyR = 90;\nvar bodyG = 100;\nvar bodyB = 90;\nvar eyeY = 3;\nvar eyeX = 1;\nvar faceR = 90;\nvar faceG = 100;\nvar faceB = 90;\nvar hatR = 140;\nvar normFaceR = 255;\nvar normFaceG = 220;\n\nfunction setup() {\n    createCanvas(480,640);\n}\n\nfunction draw() {\n    strokeWeight(1);\n    stroke(0);\n    background(20,160,190);\n    if(counter &gt;= 1 & counter < 2){\n    \/\/body\n    fill(bodyR,bodyG,bodyB);\n    circle(width\/2,height-50,500);\n}\n    \/\/face\n    fill(normFaceR, normFaceG, 177);\n    ellipse(width \/ 2, height \/ 2, faceWidth,  faceHeight);\n    var eyeLX = width \/ 2 - faceWidth * 0.3;\n    var eyeRX = width \/ 2 + faceWidth * 0.3;\n    strokeWeight(3);\n    fill(250,250,250);\n    \/\/eye\n    ellipse(eyeLX, height \/ 2-10, eyeSize*2, eyeSize-5);\n    ellipse(eyeRX, height \/ 2-10, eyeSize*2, eyeSize-5);\n    fill(70,30,20);\n    circle(eyeLX, height \/ 2-10, eyeSize\/2, eyeSize\/3);\n    circle(eyeRX, height \/ 2-10, eyeSize\/2, eyeSize\/3);\n\n   \n\/\/cowboy \n    if (counter &gt;= 1 & counter < 2){\n        noStroke();\n        fill(hatR,75,0);\n        rect(width\/2-60,height\/2-faceHeight\/2-hatH,120,hatH)\n        ellipse(width\/2,height\/2-faceHeight\/2,faceWidth-50,40);\n       \/\/facial hair\n        strokeWeight(5);\n        stroke(140,110,100);\n        noFill();\n        curve( width\/2-faceWidth\/2 + 30, height\/2 -100,\n        width\/2-faceWidth\/2 + 50, height\/2 -50,\n        width\/2-faceWidth\/2 + 80, height\/2 -50,\n        width\/2-faceWidth\/2 + 110, height\/2 -30);\n        curve( width\/2+faceWidth\/2 + 30, height\/2 -100,\n        width\/2+faceWidth\/2 - 50, height\/2 -50,\n        width\/2+faceWidth\/2 - 80, height\/2 -50,\n        width\/2+faceWidth\/2 - 110, height\/2 -30);\n        stroke(200,20,30);\n        fill(200,20,30);\n        \/\/mouth\n        curve(width\/2-faceWidth\/2 + 110,height\/2-70\n        ,width\/2-50,height\/2+30\n        ,width\/2+50,height\/2+30,\n        width\/2+faceWidth\/2 ,height\/2-30);\n        \/\/arms\n        fill(20);\n        stroke(10);\n        strokeWeight(5);\n        curve(width\/2 - 150, height\/2+100,\n        width\/2-200,height\/2+150,\n        width\/2-100,height-20,\n        width\/2-40, height-50);\n        curve(width\/2 + 150, height\/2+100,\n        width\/2+200,height\/2+150,\n        width\/2+100,height-20,\n        width\/2+40, height-50);\n\n    }\n\n\/\/alien\n     if (counter &gt;= 2 & counter < 3){\n        strokeWeight(8);\n        stroke(50,210,150);\n        line(width\/2,height\/2-faceHeight\/2, width\/2, faceHeight\/10+30);\n        fill(mouseX,mouseY,mouseX);\n        ellipse(width\/2, faceHeight\/10+30, faceWidth\/5, faceHeight\/3);\n        fill(faceR,faceG,faceB);\n        ellipse(width \/ 2, height \/ 2, faceWidth,  faceHeight);\n        \/\/eye\n        fill(0,50,10);\n        noStroke();\n        ellipse(eyeLX+30, height \/ 2-10, eyeSize*eyeX, eyeSize*eyeY);\n        ellipse(eyeRX-30, height \/ 2-10, eyeSize*eyeY, eyeSize*eyeX);\n        fill(0);\n        ellipse(eyeLX+30, height \/ 2-10, eyeSize*eyeX-5, eyeSize*eyeY-5);\n        ellipse(eyeRX-30, height \/ 2-10, eyeSize*eyeY-10, eyeSize*eyeX-10);\n        \/\/body\n        stroke(0);\n        strokeWeight(1);\n        fill(0,faceG-80,faceB+50);\n        triangle(150,height\/2+150,width-150,height\/2+150,width\/2,height-20);\n        \/\/arms\n        fill(0,200,0);\n        stroke(0,200,0);\n        strokeWeight(1);\n        curve(width\/2 - 60, height\/2+100,\n        width\/2-200,height\/2+150,\n        width\/2-30,height-80,\n        width\/2-40, height-50);\n        line(width\/2-30,height-80,width\/2-50,height-60);\n        curve(width\/2 + 60, height\/2+100,\n        width\/2+200,height\/2+150,\n        width\/2+30,height-80,\n        width\/2+40, height-50);\n        line(width\/2+30,height-80,width\/2+50,height-60);\n        \/\/mouth\n        fill(20,200,200);\n        strokeWeight(2);\n        stroke(30,100,500);\n        rect(width\/2-faceWidth\/6,height\/2+faceHeight\/6,faceWidth\/3,faceHeight\/20);\n\n   }\n\n   \/\/crazy\n\n    if(counter &lt; 1){\n        background(200,50,50);\n        fill(200,50,90);\n        ellipse(width \/ 2, height \/ 2, faceWidth+random(20,50),  faceHeight+random(20,50));\n        fill(255);\n        \/\/body\n        stroke(0);\n        strokeWeight(1);\n        fill(0,faceG-80,faceB+50);\n\n        \/\/\n\n        fill(255);\n\n       \/\/eye\n        ellipse(width \/ 2, height \/ 2, faceWidth,  faceHeight);\n        ellipse(eyeLX+30, height \/ 2-10, random(30,50),random(40,80));\n        ellipse(eyeRX-30, height \/ 2-10, random(30,50),random(20,80));\n        fill(random(10,80),random(100,255),random(150,255));\n        ellipse(eyeLX+30, height \/ 2-10, random(30,50)-10,random(40,80)-10);\n        fill(random(150,255),random(10,80),random(150,205));\n        ellipse(eyeRX-30, height \/ 2-10, random(30,50)-10,random(20,80)-10);\n        fill(random(30));\n        ellipse(eyeLX+30, height \/ 2-10, 10,10);\n        ellipse(eyeRX-30, height \/ 2-10, 10,10);\n        \/\/brows\n        line(width\/2-80,height\/2-random(60,100),width\/2-random(20,40),height\/2-20);\n        line(width\/2-80,height\/2-random(60,100),width\/2-random(20,40),height\/2-20);\n        line(width\/2+80,height\/2-random(60,100),width\/2+random(20,40),height\/2-20);\n        line(width\/2+80,height\/2-random(60,90),width\/2+random(10,50),height\/2-20);\n        \/\/nose\n        fill(random(100,255),50,50);\n        ellipse(width\/2-10,height\/2+30,10,20);\n        ellipse(width\/2+10,height\/2+30,10,20);\n        \/\/mouth\n        curve(width\/2-faceWidth\/2 + random(90,120),height\/2+100\n        ,width\/2-50,height\/2+random(60,80)\n        ,width\/2+50,height\/2+random(60,70),\n        width\/2+faceWidth\/2 ,height\/2+random(90,120));\n        \/\/body\n        fill(20,20,20);\n        triangle(width\/2,height\/2+130, random(50,100),random(height-50,height),width-random(50,100),random(height-50,height));\n        \/\/arms\n        curve(width\/2 - 150, height\/2-100,\n        width\/2-random(190,210),height\/2-150,\n        width\/2-100,height-30,\n        width\/2-40, height-50);\n        curve(width\/2 + 150, height\/2-100,\n        width\/2+200,height\/2-150,\n        width\/2+random(90,110),height-30,\n        width\/2+40, height-50);\n    }\n\n}\n \nfunction mousePressed() {\n    \/\/ when the user clicks, these variables are reassigned\n    \/\/ to random values within specified ranges. For example,\n    \/\/ 'faceWidth' gets a random value between 75 and 150.\n    faceWidth = random(300, 400);\n    faceHeight = random(190,270);\n    eyeSize = random(15, 30);\n    counter = random(0,3);\n    bodyR = random(100,110);\n    bodyG = random(100,160);\n    bodyB = random(30,150);\n    faceR = random(20,80);\n    faceG = random(100,250);\n    faceB = random(100,110);\n    eyeY = random(1,6);\n    eyeX = random(0.5,2);\n    hatR = random(100,255);\n    normFaceR = random(210,255);\n    normFaceG = random(190,220);\n}<\/code><\/pre><\/div><\/body><\/html>\n","protected":false},"excerpt":{"rendered":"<p>project 2 sketch var eyeSize = 20; var faceWidth = 300; var faceHeight = 250; var counter = 1; var hatH = faceHeight\/1.5; var bodyR = 90; var bodyG = 100; var bodyB = 90; var eyeY = 3; var eyeX = 1; var faceR = 90; var faceG = 100; var faceB = 90; &hellip; <a href=\"https:\/\/courses.ideate.cmu.edu\/15-104\/f2022\/2022\/09\/11\/project-2\/\" class=\"more-link\">Continue reading<span class=\"screen-reader-text\"> &#8220;Project 2&#8221;<\/span><\/a><\/p>\n","protected":false},"author":738,"featured_media":0,"comment_status":"open","ping_status":"closed","sticky":false,"template":"","format":"standard","meta":[],"categories":[97,55,1],"tags":[],"_links":{"self":[{"href":"https:\/\/courses.ideate.cmu.edu\/15-104\/f2022\/wp-json\/wp\/v2\/posts\/71511"}],"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\/738"}],"replies":[{"embeddable":true,"href":"https:\/\/courses.ideate.cmu.edu\/15-104\/f2022\/wp-json\/wp\/v2\/comments?post=71511"}],"version-history":[{"count":3,"href":"https:\/\/courses.ideate.cmu.edu\/15-104\/f2022\/wp-json\/wp\/v2\/posts\/71511\/revisions"}],"predecessor-version":[{"id":72107,"href":"https:\/\/courses.ideate.cmu.edu\/15-104\/f2022\/wp-json\/wp\/v2\/posts\/71511\/revisions\/72107"}],"wp:attachment":[{"href":"https:\/\/courses.ideate.cmu.edu\/15-104\/f2022\/wp-json\/wp\/v2\/media?parent=71511"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/courses.ideate.cmu.edu\/15-104\/f2022\/wp-json\/wp\/v2\/categories?post=71511"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/courses.ideate.cmu.edu\/15-104\/f2022\/wp-json\/wp\/v2\/tags?post=71511"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}