{"id":74060,"date":"2022-10-08T22:15:43","date_gmt":"2022-10-09T02:15:43","guid":{"rendered":"https:\/\/courses.ideate.cmu.edu\/15-104\/f2022\/?p=74060"},"modified":"2022-10-08T22:15:43","modified_gmt":"2022-10-09T02:15:43","slug":"project-06-clock","status":"publish","type":"post","link":"https:\/\/courses.ideate.cmu.edu\/15-104\/f2022\/2022\/10\/08\/project-06-clock\/","title":{"rendered":"Project 06: 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=\"600\" data-height=\"550\" href=\"https:\/\/courses.ideate.cmu.edu\/15-104\/f2022\/wp-content\/uploads\/2022\/10\/sketch-85.js\">sketch<\/a><iframe src=\"https:\/\/courses.ideate.cmu.edu\/15-104\/f2022\/wp-content\/plugins\/p5-embedder\/p5_iframe.html\" class=\"p5_exampleFrame\" width=\"600\" height=\"550\"><\/iframe><pre class=\"language-javascript\"><code class=\"p5_editor language-javascript\">\/\/Name: Hari Vardhan Sampath\n\/\/Section: E\n\/\/eMail address: harivars@andrew.cmu.edu\n\/\/Project-06\n\nfunction setup() {\n    createCanvas(450, 300);\n}\n\nfunction draw() {\n    var s = map(second(), 0, 60, 0 , width); \/\/runs from left to right\n    var m = map(minute(), 0, 60, 0 , width); \/\/runs from left to right\n    var h = map(hour(), 0, 24, height , 0); \/\/runs from bottom to top\n    var cR;\n    var cG;\n    var cB;\n    \/\/ color caliberation for the background w.r.t. hour\n    if (hour() &gt; 0 & hour() < 6) {\n        cR = 0;\n        cG = 50;\n        cB = 100;\n    }\n    else if (hour() &gt; 6 & hour() < 15) {\n        cR = 50;\n        cG = 150;\n        cB = 250;\n    }\n    else if (hour() &gt; 15 & hour() < 19) {\n        cR = 50;\n        cG = 150;\n        cB = 250;\n    }\n    else if (hour() &gt; 19 & hour() < 24) {\n        cR = 0;\n        cG = 25;\n        cB = 51;\n    }\n    background(cR, cG, cB); \/\/ cliberated background\n\n    \/\/ grid for second\n    for (var xS = 0; xS &lt;= width; xS += width\/60) {\n        stroke('rgba(10, 10, 10, 0.9)');\n        strokeWeight(1);\n        line(xS, 200, xS, height);\n    }\n    \/\/ grid for minute\n    for (var xM = 0; xM &lt;= width; xM += width\/60) {\n        stroke('rgba(10, 10, 10, 0.9)');\n        strokeWeight(4);\n        line(xM, 100, xM, 200);\n    }\n    \/\/ grid for hour\n    for (var xH = 0; xH &lt;= width; xH += height\/24) {\n        stroke('rgba(10, 10, 10, 0.9)');\n        strokeWeight(10);\n        line(width\/2, xH, width - height\/2, xH);\n    }\n    \/\/ second runs along the horizontal grid left to right\n    push();\n    stroke(cR, cG, cB);\n    strokeWeight(2);\n    line(s, 200, s, height);\n    pop();\n    \/\/ minuit runs along the horizontal grid from left to right\n    push();\n    stroke(cR, cG, cB);\n    strokeWeight(3);\n    line(m, 100, m, 200);\n    pop();\n    \/\/ hour runs along the vertical grid from bottom to top \n    push();\n    stroke(cR, cG, cB);\n    strokeWeight(9);\n    line(width\/2, h, width - height\/2, h);\n    pop();\n}\n<\/code><\/pre><\/p>\n\n\n\n<p><\/p><\/body><\/html>\n","protected":false},"excerpt":{"rendered":"<p>sketch \/\/Name: Hari Vardhan Sampath \/\/Section: E \/\/eMail address: harivars@andrew.cmu.edu \/\/Project-06 function setup() { createCanvas(450, 300); } function draw() { var s = map(second(), 0, 60, 0 , width); \/\/runs from left to right var m = map(minute(), 0, 60, 0 , width); \/\/runs from left to right var h = map(hour(), 0, 24, height &hellip; <a href=\"https:\/\/courses.ideate.cmu.edu\/15-104\/f2022\/2022\/10\/08\/project-06-clock\/\" class=\"more-link\">Continue reading<span class=\"screen-reader-text\"> &#8220;Project 06: Clock&#8221;<\/span><\/a><\/p>\n","protected":false},"author":756,"featured_media":0,"comment_status":"open","ping_status":"closed","sticky":false,"template":"","format":"standard","meta":[],"categories":[106,121],"tags":[],"_links":{"self":[{"href":"https:\/\/courses.ideate.cmu.edu\/15-104\/f2022\/wp-json\/wp\/v2\/posts\/74060"}],"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\/756"}],"replies":[{"embeddable":true,"href":"https:\/\/courses.ideate.cmu.edu\/15-104\/f2022\/wp-json\/wp\/v2\/comments?post=74060"}],"version-history":[{"count":2,"href":"https:\/\/courses.ideate.cmu.edu\/15-104\/f2022\/wp-json\/wp\/v2\/posts\/74060\/revisions"}],"predecessor-version":[{"id":74067,"href":"https:\/\/courses.ideate.cmu.edu\/15-104\/f2022\/wp-json\/wp\/v2\/posts\/74060\/revisions\/74067"}],"wp:attachment":[{"href":"https:\/\/courses.ideate.cmu.edu\/15-104\/f2022\/wp-json\/wp\/v2\/media?parent=74060"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/courses.ideate.cmu.edu\/15-104\/f2022\/wp-json\/wp\/v2\/categories?post=74060"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/courses.ideate.cmu.edu\/15-104\/f2022\/wp-json\/wp\/v2\/tags?post=74060"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}