{"id":74160,"date":"2022-10-09T20:50:51","date_gmt":"2022-10-10T00:50:51","guid":{"rendered":"https:\/\/courses.ideate.cmu.edu\/15-104\/f2022\/?p=74160"},"modified":"2022-10-09T20:52:11","modified_gmt":"2022-10-10T00:52:11","slug":"project-6-abstract-clock-4","status":"publish","type":"post","link":"https:\/\/courses.ideate.cmu.edu\/15-104\/f2022\/2022\/10\/09\/project-6-abstract-clock-4\/","title":{"rendered":"Project 6 &#8211; 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>I created an ice cream clock. The scoops run on standard time rather than military time so for every hour, a scoop is added. At 12 pm there is no scoop and it resets. For every second, a new sprinkle falls to the bottom and the chocolate ice cream slowly changes to a raspberry color. With every minute, the ice cream puddle at the bottom of the canvas gets larger ( as if its rising).<\/p>\n\n\n\n<p><\/p>\n\n\n\n<div class=\"wp-block-file\"><a id=\"wp-block-file--media-67ea9eae-241c-43ab-8c39-7737da43e37e\" class=\"p5_sketch_link\" data-width=\"480\" data-height=\"480\" href=\"https:\/\/courses.ideate.cmu.edu\/15-104\/f2022\/wp-content\/uploads\/2022\/10\/sketch-93.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=\"480\" height=\"480\"><\/iframe><pre class=\"language-javascript\"><code class=\"p5_editor language-javascript\">\/\/ SRISHT BHAVSAR\n\/\/ SECTION C 15-104\n\/\/ PROJECT 6\n\nvar diam = 30; \/\/ scoop diam\nvar h; \/\/hours \nvar m; \/\/min\nvar s; \/\/second\n\nvar c = [];\n\nfunction setup() {\n    createCanvas(200, 20);\n    background(220);\n    text(\"p5.js vers 0.9.0 test.\", 10, 15);\n    for (var i=0; i &lt; 60; i++)  {\n        c[i] = color(random(255), random(255), random(255));\n    } \n}\n\nfunction draw() {\n    createCanvas(480, 480);\n    background('lightblue'); \/\/ light blue\n\n    let h = hour();\n    let m = minute();\n    let s = second();\n\n\n    \/\/minutes equals height of puddle\n    translate(0,0)\n    stroke(210, 180, 140);\n    fill('beige');\n    rect(0,480,480,-(m));\n\n\n    push()\n    noStroke();\n    translate(500,510);\n    rotate(radians(180));\n    for (var i = 0; i &lt; diam ; i+= diam) {\n        for (var j = 0; j &lt; (h-12) * diam ; j+= diam) { \/\/ instead of military time, it is 12 hr time\n            \n            if ( j % 4 == 0) {\n                fill(98 + s,52,18+s); \/\/ chocolate\/\/ changes color by second\n            }\n\n            if ( j % 4 == 1) {\n                fill('beige'); \/\/ vanilla\n\n            }\n\n            if ( j % 4 == 2) {\n                fill('lightpink'); \/\/ strawberry\n            }\n\n\n            circle(250,j+150,diam); \/\/ scoop\n\n        }\n    }\n    pop();\n\n\n\/\/ ice cream cone w month and date\n    push();\n    fill(210, 180, 140);\n    strokeWeight(5);\n    stroke('beige');\n    translate(150,320);\n    scale(.5);\n    triangle(155,100,203,300,245,100); \n    pop();\n\n\n\n\/\/ ice cream sprinkles are seconds\n    push();\n    fill(c[i])\n    scale(0.8);\n\n    for(var i =0; i &lt; 4; i+= 4){\n        for(var j = 0; j &lt; (s*10); j+= 7) {\n            ellipse(310, j, 3, 5);\n        }\n    }\n    pop();\n    frameRate(1);\n\n} \n\n\n\n<\/code><\/pre><\/div><\/body><\/html>\n","protected":false},"excerpt":{"rendered":"<p>I created an ice cream clock. The scoops run on standard time rather than military time so for every hour, a scoop is added. At 12 pm there is no scoop and it resets. For every second, a new sprinkle falls to the bottom and the chocolate ice cream slowly changes to a raspberry color. &hellip; <a href=\"https:\/\/courses.ideate.cmu.edu\/15-104\/f2022\/2022\/10\/09\/project-6-abstract-clock-4\/\" class=\"more-link\">Continue reading<span class=\"screen-reader-text\"> &#8220;Project 6 &#8211; Abstract Clock&#8221;<\/span><\/a><\/p>\n","protected":false},"author":704,"featured_media":0,"comment_status":"open","ping_status":"closed","sticky":false,"template":"","format":"standard","meta":[],"categories":[106,57],"tags":[90],"_links":{"self":[{"href":"https:\/\/courses.ideate.cmu.edu\/15-104\/f2022\/wp-json\/wp\/v2\/posts\/74160"}],"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\/704"}],"replies":[{"embeddable":true,"href":"https:\/\/courses.ideate.cmu.edu\/15-104\/f2022\/wp-json\/wp\/v2\/comments?post=74160"}],"version-history":[{"count":4,"href":"https:\/\/courses.ideate.cmu.edu\/15-104\/f2022\/wp-json\/wp\/v2\/posts\/74160\/revisions"}],"predecessor-version":[{"id":74167,"href":"https:\/\/courses.ideate.cmu.edu\/15-104\/f2022\/wp-json\/wp\/v2\/posts\/74160\/revisions\/74167"}],"wp:attachment":[{"href":"https:\/\/courses.ideate.cmu.edu\/15-104\/f2022\/wp-json\/wp\/v2\/media?parent=74160"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/courses.ideate.cmu.edu\/15-104\/f2022\/wp-json\/wp\/v2\/categories?post=74160"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/courses.ideate.cmu.edu\/15-104\/f2022\/wp-json\/wp\/v2\/tags?post=74160"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}