{"id":67420,"date":"2021-10-10T22:16:58","date_gmt":"2021-10-11T02:16:58","guid":{"rendered":"https:\/\/courses.ideate.cmu.edu\/15-104\/f2021\/?p=67420"},"modified":"2021-10-10T22:27:55","modified_gmt":"2021-10-11T02:27:55","slug":"project-06-abstract-clock-10","status":"publish","type":"post","link":"https:\/\/courses.ideate.cmu.edu\/15-104\/f2021\/2021\/10\/10\/project-06-abstract-clock-10\/","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>For my abstract clock I chose to use a database of song lyrics that mention specific times of day. The clock breaks up the day into 886 equal units of time, the number of song lyrics in the data set, and displays each lyric one after another. The background color also changes with the time of day being referenced in the song. As a result the time measured by this clock is not the actual time of day, but rather the time of day represented within our popular musical cannon mapped to a real 24 hour day. Hours that are referenced more often last longer on this clock and those only mentioned a few times pass by quickly.<\/p>\n\n\n\n<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-64.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\">\/\/Tim Nelson-Pyne\n\/\/tnelsonp@andrew.cmu.edu\n\/\/Section C\n\/\/Project-06-Abstract Clock\n\n\n\nfunction preload() {\n  \/\/loads a .txt file that contains a large sampling of song lyrics \n  \/\/that refer to specific times of day\n  timeLyrics = loadStrings('https:\/\/courses.ideate.cmu.edu\/15-104\/f2021\/wp-content\/uploads\/2021\/10\/timeLyrics.txt')\n}\n\nfunction setup() {\n  createCanvas(400, 400);\n  background(0);\n  \n}\n\nfunction draw() {\n\n  \/\/gets the total amount of seconds that have ellapsed that day\n  var s = second();\n  var m = minute();\n  var h = hour();\n  m = m * 60\n  h = h * 3600\n  var totalS = m + h + s;\n  \n\n  var i = map(totalS, 0, 86400, 0, 886);\n  i = round(i);\n  \n  \/\/changes background color based on the time that the song lyrics are refering to\n  if (i &lt; 421 || i &gt; 780) {\n    \/\/its nightime\n    fill(0);\n  }\n  if (i &gt;= 421 & i < 481) {\n    \/\/its 5am\n    fill(10, 0, 50);\n  }\n  if (i &gt;= 481 & i < 538) {\n    \/\/its 6am\n    fill(141, 163, 152);\n  }\n  if (i &gt;= 538 & i < 562) {\n    \/\/its 7 am\n    fill(217, 133, 69);\n  }\n  if (i &gt;= 562 & i < 595) {\n    \/\/its 8 am\n    fill(249, 192, 107);\n\n  }\n  if (i &gt;= 595 & i < 628) {\n    \/\/its 9 am\n    fill(255, 230, 190);\n  }\n  if (i &gt;= 628 & i < 631){\n    \/\/its 10 am\n    fill(255, 255, 200);\n\n  }\n  if (i &gt;= 631 & i < 722) {\n    \/\/its day\n    fill(255);\n  }\n  if (i &gt;= 722 & i < 747) {\n    \/\/its 5pm\n    fill(255, 230, 190);\n  }\n  if (i &gt;= 747 & i < 761) {\n    \/\/its 6pm\n    fill(238, 108, 32);\n\n  }\n  if (i &gt;= 761 & i <= 780) {\n    \/\/its 7pm\n    fill(100, 15, 36);\n  }\n  \n  textSize(15);\n  noStroke();\n  \/\/redraws the background\n  rect(0, 0, width, height);\n\n  \/\/changes the type color based on what the background color is\n  if (i &lt; 421 || i &gt; 780) {\n    fill(255);\n  }\n  else {\n    fill(100);\n  }\n\n  \/\/displays a song lyric\n  \/\/each lyric gets the same amount of time on screen\n  \/\/the lyrics repeat each day\n  textAlign(CENTER);\n  text(timeLyrics[i], 0, 10, width, height);\n  \n  \n  \n}<\/code><\/pre><\/p>\n\n\n\n<p><\/p><\/body><\/html>\n","protected":false},"excerpt":{"rendered":"<p>For my abstract clock I chose to use a database of song lyrics that mention specific times of day. The clock breaks up the day into 886 equal units of time, the number of song lyrics in the data set, and displays each lyric one after another. The background color also changes with the time &hellip; <a href=\"https:\/\/courses.ideate.cmu.edu\/15-104\/f2021\/2021\/10\/10\/project-06-abstract-clock-10\/\" class=\"more-link\">Continue reading<span class=\"screen-reader-text\"> &#8220;Project 06: Abstract Clock&#8221;<\/span><\/a><\/p>\n","protected":false},"author":662,"featured_media":0,"comment_status":"open","ping_status":"closed","sticky":false,"template":"","format":"standard","meta":[],"categories":[106,57],"tags":[],"_links":{"self":[{"href":"https:\/\/courses.ideate.cmu.edu\/15-104\/f2021\/wp-json\/wp\/v2\/posts\/67420"}],"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\/662"}],"replies":[{"embeddable":true,"href":"https:\/\/courses.ideate.cmu.edu\/15-104\/f2021\/wp-json\/wp\/v2\/comments?post=67420"}],"version-history":[{"count":2,"href":"https:\/\/courses.ideate.cmu.edu\/15-104\/f2021\/wp-json\/wp\/v2\/posts\/67420\/revisions"}],"predecessor-version":[{"id":67434,"href":"https:\/\/courses.ideate.cmu.edu\/15-104\/f2021\/wp-json\/wp\/v2\/posts\/67420\/revisions\/67434"}],"wp:attachment":[{"href":"https:\/\/courses.ideate.cmu.edu\/15-104\/f2021\/wp-json\/wp\/v2\/media?parent=67420"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/courses.ideate.cmu.edu\/15-104\/f2021\/wp-json\/wp\/v2\/categories?post=67420"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/courses.ideate.cmu.edu\/15-104\/f2021\/wp-json\/wp\/v2\/tags?post=67420"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}