{"id":67686,"date":"2021-10-09T17:45:43","date_gmt":"2021-10-09T21:45:43","guid":{"rendered":"https:\/\/courses.ideate.cmu.edu\/15-104\/f2021\/?p=67686"},"modified":"2021-10-16T18:00:32","modified_gmt":"2021-10-16T22:00:32","slug":"project06-abstract-clock","status":"publish","type":"post","link":"https:\/\/courses.ideate.cmu.edu\/15-104\/f2021\/2021\/10\/09\/project06-abstract-clock\/","title":{"rendered":"Project-06-Abstract-Clock"},"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><a class=\"p5_sketch_link\" data-width=\"400\" data-height=\"400\" href=\"https:\/\/courses.ideate.cmu.edu\/15-104\/f2021\/wp-content\/uploads\/2021\/10\/sketch-95.js\">sketch<\/a><iframe src=\"https:\/\/courses.ideate.cmu.edu\/15-104\/f2021\/wp-content\/plugins\/p5-embedder\/p5_iframe.html\" class=\"p5_exampleFrame\" width=\"400\" height=\"400\"><\/iframe><pre class=\"language-javascript\"><code class=\"p5_editor language-javascript\">function setup() {\n    createCanvas(400, 400);\n    angleMode(DEGREES);\n}\n\nfunction draw() {\n    background(240, 217, 156);\n\n    fill(220);\n\n    strokeWeight(2);\n    ellipse(200,200,395);\n\n\n    fill('magenta');\n    stroke(150,255,100);\n    ellipse(200,180,50);\n\n    fill(183, 156, 240);\n    strokeWeight(6);\n    arc(200,250,200,150,0,180,CHORD);\n\n\n    let hr = hour();\n    let mn = minute();\n    let sc = second();\n\n    strokeWeight(4);\n    stroke(255,100,150);\n    noFill();\n    let end1 = map(sc,0,60,0,360);\n    arc(120,120,35,35,0,end1);\n    arc(280,120,35,35,0,end1);\n\n    stroke(150,100,255);\n    let end2 = map(mn,0,60,0,360);\n    arc(120,120,28,28,0,end2);\n    arc(280,120,28,28,0,end2);\n\n    stroke(150,255,100);\n    let end3 = map(hr % 12,0,12,0,360);\n    arc(120,120,20,20,0,end3);\n    arc(280,120,20,20,0,end3);\n\n\n    stroke(\"orange\");\n    let s = map(second(),0,60,0,360) - 180;\n    line(200,180,200 + cos(s)*50, 180 + sin(s)*50);\n\n    strokeWeight(2);\n    text('hehe: \\n' + s, 100, 190);\n    text('hehe: \\n' + s, 300, 190);\n\n\n    strokeWeight(1);\n    stroke('red');\n    text('Hey_time: \\n' + hr + 'hours' + mn + 'minutes', 100, 50);\n\n\n\n}\n\nfunction mouseIsPressed() {\n    if (s % 5 == 0){\n    fill('blue');\n    strokeWeight(6);\n    stroke(0);\n    arc(200,250,200,150,0,180,CHORD);\n    } else {\n        fill(183, 156, 240);\n        strokeWeight(6);\n        stroke(0);\n        arc(200,250,200,150,0,180,CHORD);\n    }\n}\n\n\n\n<\/code><\/pre><\/p>\n\n\n\n<p>This project was quite challenging. I had to search through the internet to learn how to call the numbers using javascript. It turned out to be easy. However, contextualizing my concepts to code was again very difficult. I tried to create a cute face using functions that implement the numbers of the clock. However, as always, it turned out quite differently than my sketch. I used lines on the nose and used the print function to print the time on the top left corner of the canvas.<\/p><\/body><\/html>\n","protected":false},"excerpt":{"rendered":"<p>sketch function setup() { createCanvas(400, 400); angleMode(DEGREES); } function draw() { background(240, 217, 156); fill(220); strokeWeight(2); ellipse(200,200,395); fill(&#8216;magenta&#8217;); stroke(150,255,100); ellipse(200,180,50); fill(183, 156, 240); strokeWeight(6); arc(200,250,200,150,0,180,CHORD); let hr = hour(); let mn = minute(); let sc = second(); strokeWeight(4); stroke(255,100,150); noFill(); let end1 = map(sc,0,60,0,360); arc(120,120,35,35,0,end1); arc(280,120,35,35,0,end1); stroke(150,100,255); let end2 = map(mn,0,60,0,360); arc(120,120,28,28,0,end2); arc(280,120,28,28,0,end2); stroke(150,255,100); let &hellip; <a href=\"https:\/\/courses.ideate.cmu.edu\/15-104\/f2021\/2021\/10\/09\/project06-abstract-clock\/\" class=\"more-link\">Continue reading<span class=\"screen-reader-text\"> &#8220;Project-06-Abstract-Clock&#8221;<\/span><\/a><\/p>\n","protected":false},"author":672,"featured_media":0,"comment_status":"open","ping_status":"closed","sticky":false,"template":"","format":"standard","meta":[],"categories":[106,58],"tags":[],"_links":{"self":[{"href":"https:\/\/courses.ideate.cmu.edu\/15-104\/f2021\/wp-json\/wp\/v2\/posts\/67686"}],"collection":[{"href":"https:\/\/courses.ideate.cmu.edu\/15-104\/f2021\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/courses.ideate.cmu.edu\/15-104\/f2021\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/courses.ideate.cmu.edu\/15-104\/f2021\/wp-json\/wp\/v2\/users\/672"}],"replies":[{"embeddable":true,"href":"https:\/\/courses.ideate.cmu.edu\/15-104\/f2021\/wp-json\/wp\/v2\/comments?post=67686"}],"version-history":[{"count":6,"href":"https:\/\/courses.ideate.cmu.edu\/15-104\/f2021\/wp-json\/wp\/v2\/posts\/67686\/revisions"}],"predecessor-version":[{"id":67709,"href":"https:\/\/courses.ideate.cmu.edu\/15-104\/f2021\/wp-json\/wp\/v2\/posts\/67686\/revisions\/67709"}],"wp:attachment":[{"href":"https:\/\/courses.ideate.cmu.edu\/15-104\/f2021\/wp-json\/wp\/v2\/media?parent=67686"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/courses.ideate.cmu.edu\/15-104\/f2021\/wp-json\/wp\/v2\/categories?post=67686"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/courses.ideate.cmu.edu\/15-104\/f2021\/wp-json\/wp\/v2\/tags?post=67686"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}