{"id":74039,"date":"2022-10-08T21:26:47","date_gmt":"2022-10-09T01:26:47","guid":{"rendered":"https:\/\/courses.ideate.cmu.edu\/15-104\/f2022\/?p=74039"},"modified":"2022-10-08T21:26:47","modified_gmt":"2022-10-09T01:26:47","slug":"anabelles-project-06","status":"publish","type":"post","link":"https:\/\/courses.ideate.cmu.edu\/15-104\/f2022\/2022\/10\/08\/anabelles-project-06\/","title":{"rendered":"anabelle&#8217;s 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>we always think too much about how time passes by too quickly. don&rsquo;t be obsessed with aging, and just think about the good that comes with your birthday!<\/p>\n\n\n\n<p>the background indicates to minute (to some extent). at the start of the hour, the background will be pink. it will become increasingly bluer the greater the minute is. <\/p>\n\n\n\n<p>the number of strawberries on the cake indicate the hour of the day in a 12-hour cycle. to distinguish am and pm, the fruit will turn into blueberries in the am and strawberries in the pm.<\/p>\n\n\n\n<p>the number of candles indicates the month and the number of gifts indicates the day. <\/p>\n\n\n\n<div><a class=\"p5_sketch_link\" href=\"https:\/\/courses.ideate.cmu.edu\/15-104\/f2022\/wp-content\/uploads\/2022\/10\/sketch-82.js\" data-width=\"480\" data-height=\"480\">sketch<\/a>\n\n\n\n\n<p><\/p><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\">\/\/ kayla anabelle lee (kaylalee)\n\/\/ kaylalee@andrew.cmu.edu\n\/\/ section c\n\/\/ project 6\n\n\/\/ define variables\nlet redValue, blueValue, greenValue;\nlet strawberryFill;\nlet giftCounter;\nlet giftDraw;\n\nfunction setup() {\n    createCanvas(480, 480);\n    let h = hour(); \n    let m = minute();\n    let d = day();\n    let mon = month();\n\n    \/\/ initialize background color\n    redValue = 248;\n    blueValue = 226;\n    greenValue = 226;\n\n    giftCounter = 0;\n\n}\n\nfunction draw() {\n    \/\/ every minute, the background changes by this increment\n    let redMinute = 1.25;\n    let blueMinute = 0.633;\n    let greenMinute = 0.1167;\n\n    \/\/ final color will be (173, 188, 219)\n    background(redValue - (redMinute*minute()), blueValue - (blueMinute*minute()), greenValue - (greenMinute*minute())); \/\/ final color will be (173, 188, 219)\n\n    \/\/ set color variables for helper functions\n    let cakeColor = color(255, 214, 148);\n    let icingColor = color(246, 158, 178);\n    let tableColor = color(112, 77, 36);\n\n    let candleColor = color(247, 200, 238);\n    let outerFire = color(245, 154, 142);\n    let innerFire = color(255, 202, 150);\n\n    let giftColor = color(171, 156, 217);\n    let ribbonColor = color(248, 239, 233);\n\n    \/\/ draw table and cake\n    table(150, height - 105, 275, 190, tableColor); \/\/ 4\/3 ratio\n    cakeBase(150, height - 160, 150, 75, cakeColor);\n    cakeBase(150, height - 230, 100, 50, cakeColor);\n\n    \/\/ the number of candles = month (12 candles total)\n    for (i = 1; i &lt;= month()%12; i++) {\n        if (i &lt;= 6) {\n            candle(i*15 + 96, 205, 8, 32, candleColor); \/\/ (top row)\n\n        } else {\n            candle(i*20 - 45, 255, 10, 40, candleColor); \/\/ 2\/3 ratio (bottom row)\n        }\n    }\n\n    \/\/ the number of gifts = day (31 total)\n    giftDraw = true;\n    giftCounter = 0;\n    for (i = 0; i &lt; 7; i++) {\n        for (j = 0; j &lt; 5; j++) {\n            if (giftCounter &gt;= day()) {\n                giftDraw = false;\n            } gift(280 + 30*i, 470 - 30*j, 25, 25, giftColor, ribbonColor, giftDraw);   \n            giftCounter += 1;\n        }\n    }\n\n    print (giftCounter);\n\n    \/\/ now working on strawberries\n    \/\/ for PM, fill is BLUE. for AM, fill is PINK)\n    if (hour() &lt;= 12) {\n        strawberryFill = color(73, 104, 152);\n    } if (hour() &gt; 12) {\n        strawberryFill = color(231, 84, 128);\n    }\n\n    \/\/ the number of strawberries = hour of the day (12 strawberries total)\n    for (i = 1; i &lt;= hour()%12; i ++) {\n        if (i &lt;= 6) {\n            strawberry(i*16 + 92, 220, 15, 25, strawberryFill); \/\/ (top row)\n\n        } else {\n            strawberry(i*22 - 60, 270, 15, 25, strawberryFill); \/\/ 2\/3 ratio (bottom row)\n        }\n    }\n\n    textSize(20);\n    textAlign(CENTER);\n    text('life is too short to worry about time. eat some cake!', 220, 180, 300, 200);\n\n}\n\n\/*my functions*\/\n\nfunction cakeBase(x, y, w, h, color) { \/\/ draws the bread part of cake\n    var r = (w \/ 6);\n    noStroke();\n    fill(color);\n\n    \/\/ base rectangle\n    rectMode(CENTER);\n    rect(x, y, w, h);\n\n    \/\/ left arc\n    arc(x - w\/2 + r\/2, y - h\/2, r, r, radians(180), radians(270));\n\n    \/\/ right arc\n    arc(x + w\/2 - r\/2, y - h\/2, r, r, radians(270), radians(360));\n\n    \/\/ connect arcs\n    line(x - w\/2 + r\/2, y - 2*r, x + w\/2 - r\/2, y - 2*r);\n    rect(x, y - 7*r\/4, w - r, r\/2);\n\n}\n\nfunction table(x, y, w, h, color) { \/\/ draws table\n    fill(color);\n    rectMode(CENTER);\n    noStroke();\n\n    \/\/ vertical slabs\n    rect(x - 3*w\/10, y + 3*h\/10, w\/12, h\/2); \/\/ left\n    rect(x + 3*w\/10, y + 3*h\/10, w\/12, h\/2); \/\/ right\n\n    \/\/ horizontal slabs\n    rect(x, y, (3*w)\/4, (h\/6)); \/\/ bottom\n    rect(x, y - h\/12, w, h\/12); \/\/ top\n}\n\nfunction gift(x, y, w, h, boxColor, ribbonColor, draw) { \/\/ draws one present\n\n    if (!draw) {\n        return false;\n    }\n\n    rectMode(CENTER);\n    noStroke();\n\n    fill(boxColor) \/\/ use arrays to create different colors for each gift\n\n    \/\/ rectangles\n    rect(x, y, 4*w\/5, 4*h\/5); \/\/ bottom\n    rect(x, y - 2*h\/5, w, h\/10); \/\/ top\n\n    \/\/ bow\n    stroke(ribbonColor);\n    strokeWeight(w\/10);\n    noFill();\n    circle(x - w\/8, y - h\/2, w\/4);\n    circle(x + w\/8, y - h\/2, w\/4);\n\n    \/\/ box ribbon\n    fill(ribbonColor);\n    noStroke();\n    rectMode(CENTER);\n    rect(x, y, w\/5, 8*h\/10);\n}\n\nfunction candle(x, y, w, h, color) { \/\/ the width to height should be a 1\/4 ratio\n    rectMode(CENTER);\n    fill(color);\n    strokeWeight(1);\n    stroke(150);\n    rect(x, y, w, 4*h\/5);\n\n    fill(255, 0, 0, 150); \/\/ outer flame\n    noStroke();\n    ellipse(x, y - 3*h\/5, 4*w\/5, 3*h\/10);\n\n    fill(255, 165, 0, 150);\n    ellipse(x, y - 11*h\/20, 3*w\/5, h\/5);\n}\n\nfunction strawberry(x, y, w, h, color) { \/\/ draws one strawberry\n    fill(color);\n    noStroke();\n\n    arc(x, y, w, h, radians(180), radians(0));\n    arc(x, y, w, h\/10, radians(0), radians(180));\n\n}\n\nfunction icing(x, y, w, h, color) {\n    push();\n    translate(x, y);\n    fill(color); \n    stroke(color);\n\n    x += cos(radians(x));\n    y += sin(radians(y));\n\n    point(x, y);\n    pop();\n}<\/code><\/pre><\/div><\/body><\/html>\n","protected":false},"excerpt":{"rendered":"<p>we always think too much about how time passes by too quickly. don&rsquo;t be obsessed with aging, and just think about the good that comes with your birthday! the background indicates to minute (to some extent). at the start of the hour, the background will be pink. it will become increasingly bluer the greater the &hellip; <a href=\"https:\/\/courses.ideate.cmu.edu\/15-104\/f2022\/2022\/10\/08\/anabelles-project-06\/\" class=\"more-link\">Continue reading<span class=\"screen-reader-text\"> &#8220;anabelle&#8217;s project 06&#8221;<\/span><\/a><\/p>\n","protected":false},"author":734,"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\/f2022\/wp-json\/wp\/v2\/posts\/74039"}],"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\/734"}],"replies":[{"embeddable":true,"href":"https:\/\/courses.ideate.cmu.edu\/15-104\/f2022\/wp-json\/wp\/v2\/comments?post=74039"}],"version-history":[{"count":1,"href":"https:\/\/courses.ideate.cmu.edu\/15-104\/f2022\/wp-json\/wp\/v2\/posts\/74039\/revisions"}],"predecessor-version":[{"id":74041,"href":"https:\/\/courses.ideate.cmu.edu\/15-104\/f2022\/wp-json\/wp\/v2\/posts\/74039\/revisions\/74041"}],"wp:attachment":[{"href":"https:\/\/courses.ideate.cmu.edu\/15-104\/f2022\/wp-json\/wp\/v2\/media?parent=74039"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/courses.ideate.cmu.edu\/15-104\/f2022\/wp-json\/wp\/v2\/categories?post=74039"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/courses.ideate.cmu.edu\/15-104\/f2022\/wp-json\/wp\/v2\/tags?post=74039"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}