{"id":73938,"date":"2022-10-08T17:54:36","date_gmt":"2022-10-08T21:54:36","guid":{"rendered":"https:\/\/courses.ideate.cmu.edu\/15-104\/f2022\/?p=73938"},"modified":"2022-10-08T17:54:36","modified_gmt":"2022-10-08T21:54:36","slug":"project-06-5","status":"publish","type":"post","link":"https:\/\/courses.ideate.cmu.edu\/15-104\/f2022\/2022\/10\/08\/project-06-5\/","title":{"rendered":"Project 06"},"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>For my abstract clock, the day\/night period is from 7 am to 7 pm &amp; vice versa. This means that the sun rises &amp; sets at 7 am &amp; 7 pm, respectively. The number of stars displayed on screen references what minute it is, and one complete rotation of a star = 1 minute. The half-circle path that the sun\/moon takes can be used to tell the hour.<\/p>\n<div><a class=\"p5_sketch_link\" href=\"https:\/\/courses.ideate.cmu.edu\/15-104\/f2022\/wp-content\/uploads\/2022\/10\/sketch-70.js\" data-width=\"480\" data-height=\"480\">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\">\/\/Lily van Veen, section B, lvanveen@andrew.cmu.edu, project 6\nvar r; \/\/red value\nvar g; \/\/green value\nvar b; \/\/blue value\nvar h; \/\/hour\nvar m; \/\/min\nvar s; \/\/sec\nvar x = []; \/\/x value of top point of stars\nvar y = []; \/\/y value of top point of stars\nvar t = 0; \/\/ rotation\/turn of stars\n\nfunction setup() {\n\tframeRate(30);\n    createCanvas(480, 480);\n    background(235, 205, 124);\n    for(var i = 0; i &lt; 60; i++){ \n    \tx[i] = random(30, width-30);\n    \ty[i] = random(30, height-240);\n    }\n}\n\nfunction draw() {\n\tlet h = hour();\n    let m = minute();\n    let s = second();\n\tif(h &gt; 7 & h < 19){ \/\/\"sunrise\" and \"sunset\" will happen @ 7 am & 7 pm respectively\n    \tr = 235; \/\/yellow\n    \tg = 205;\n    \tb = 124;\n    \tbackground(r, g, b);\n    }else if(h &lt; 7 || h &gt; 19){\n    \tr = 48; \/\/blue\n    \tg = 68;\n    \tb = 133;\n    \tbackground(r, g, b);\n    }else if(h == 7){\n    \tr += .01; \/\/ w\/ .01 change in color @ 30 fps, will take abt 2 min to fully shift from day to night (also about the same time a sunset\/sunrise takes :) )\n    \tg += .01;\n    \tb -= .01;\n    \tbackground(min(r, 235), min(r, 205), max(b, 124));\n    }else if(h == 19){\n    \tr -= .01;\n    \tg -= .01;\n    \tb += .01;\n    \tbackground(max(r, 48), max(g, 68), min(b, 133));\n    }\n\n    for(var i = 0; i &lt; m; i++){ \/\/ i is used to count the # of minutes; this is the section to draw the star - initally was going to put this under a function called drawStar(); but didn't function properly\n    \tpush();\n        translate(x[i], y[i]);\n        rotate(radians(s*6));\n    \tfill(255, 249, 201); \/\/light yellow\n\t    strokeWeight(0);\n\t    triangle(0, -5, -5, 5, 5, 5);\n\t    triangle(-5, 5, -7.5, 10, 0, 7.5);\n\t    triangle(5, 5, 7.5, 10, 0, 7.5);\n\t    triangle(0, 7.5, -5, 5, 5, 5);\n\t    triangle(-5, 5, -10, 0, 0, 0);\n\t    triangle(5, 5, 10, 0, 0, 0);\n\t    pop();\n    }\n    \tpush(); \/\/creates path of sun to better indicate hour of the day, \"sun\" visible from 7 am -&gt; 7 pm\n    \ttranslate(240, 480);\n    \trotate(radians((((h-7)*60)+m)*(360\/1440)));\n    \tstrokeWeight(0);\n    \tfill(255, 248, 189);\n    \tellipse(-215, 0, 50, 50);\n    \tpop();\n\n    \tpush(); \/\/creates path of sun to better indicate hour of the day, \"sun\" visible from 7 pm -&gt; 7 am\n    \ttranslate(240, 480);\n    \trotate(radians((((h-7)*60)+m)*(360\/1440)+180));\n    \tstrokeWeight(0);\n    \tfill(255, 248, 189);\n    \tellipse(-215, 0, 50, 50); \/\/so the ellipse to carve out moon shape is the same as bg :)\n    \tif(h &gt; 7 & h < 19){ \/\/\"sunrise\" and \"sunset\" will happen @ 7 am & 7 pm respectively\n      \t    r = 235;<\/code><\/pre><\/div><\/body><\/html>\n","protected":false},"excerpt":{"rendered":"<p>For my abstract clock, the day\/night period is from 7 am to 7 pm &amp; vice versa. This means that the sun rises &amp; sets at 7 am &amp; 7 pm, respectively. The number of stars displayed on screen references what minute it is, and one complete rotation of a star = 1 minute. The &hellip; <a href=\"https:\/\/courses.ideate.cmu.edu\/15-104\/f2022\/2022\/10\/08\/project-06-5\/\" class=\"more-link\">Continue reading<span class=\"screen-reader-text\"> &#8220;Project 06&#8221;<\/span><\/a><\/p>\n","protected":false},"author":766,"featured_media":0,"comment_status":"open","ping_status":"closed","sticky":false,"template":"","format":"standard","meta":[],"categories":[106,56,1],"tags":[],"_links":{"self":[{"href":"https:\/\/courses.ideate.cmu.edu\/15-104\/f2022\/wp-json\/wp\/v2\/posts\/73938"}],"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\/766"}],"replies":[{"embeddable":true,"href":"https:\/\/courses.ideate.cmu.edu\/15-104\/f2022\/wp-json\/wp\/v2\/comments?post=73938"}],"version-history":[{"count":4,"href":"https:\/\/courses.ideate.cmu.edu\/15-104\/f2022\/wp-json\/wp\/v2\/posts\/73938\/revisions"}],"predecessor-version":[{"id":73944,"href":"https:\/\/courses.ideate.cmu.edu\/15-104\/f2022\/wp-json\/wp\/v2\/posts\/73938\/revisions\/73944"}],"wp:attachment":[{"href":"https:\/\/courses.ideate.cmu.edu\/15-104\/f2022\/wp-json\/wp\/v2\/media?parent=73938"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/courses.ideate.cmu.edu\/15-104\/f2022\/wp-json\/wp\/v2\/categories?post=73938"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/courses.ideate.cmu.edu\/15-104\/f2022\/wp-json\/wp\/v2\/tags?post=73938"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}