{"id":66943,"date":"2021-10-02T23:08:35","date_gmt":"2021-10-03T03:08:35","guid":{"rendered":"https:\/\/courses.ideate.cmu.edu\/15-104\/f2021\/?p=66943"},"modified":"2021-10-02T23:29:30","modified_gmt":"2021-10-03T03:29:30","slug":"wallpaper-project","status":"publish","type":"post","link":"https:\/\/courses.ideate.cmu.edu\/15-104\/f2021\/2021\/10\/02\/wallpaper-project\/","title":{"rendered":"Wallpaper Project"},"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=\"800\" data-height=\"600\" href=\"https:\/\/courses.ideate.cmu.edu\/15-104\/f2021\/wp-content\/uploads\/2021\/10\/sketch-17.js\">sketch<\/a><a href=\"https:\/\/courses.ideate.cmu.edu\/15-104\/f2021\/wp-content\/uploads\/2021\/10\/sketch-17.js\" class=\"wp-block-file__button\" download=\"\">Download<\/a><iframe src=\"https:\/\/courses.ideate.cmu.edu\/15-104\/f2021\/wp-content\/plugins\/p5-embedder\/p5_iframe.html\" class=\"p5_exampleFrame\" width=\"800\" height=\"600\"><\/iframe><pre class=\"language-javascript\"><code class=\"p5_editor language-javascript\">\/*\nYanina Shavialenka\nSection B\nyshavial@andrew.cmu.edu\nProject 5: Wallpaper\n*\/\n\nvar x = 100;\nvar y = 45;\nvar s = 8;\n\nvar xS1 = 193;\nvar yS1 = 60;\nvar xS2 = 193;\nvar yS2 = 115;\n\n\nfunction setup() {\n  createCanvas(600, 600);\n  background(0, 0, 51);\n  text(\"p5.js vers 0.9.0 test.\", 10, 15);\n} \n\nfunction draw() { \n    background(0, 0, 51);\n    \n    \/\/Hexagonal background\n    for(var xH = 0; xH &lt;= 600; xH += 15){\n        for (var yH = 0; yH &lt;= 600; yH += 2*s*sqrt(3)\/2){\n            fill(0, 0, 51);\n            hexagon(xH, yH);\n        }\n    }\n    for (var xH = 10; xH &lt;= 600; xH += 15){\n        for (var yH = s*sqrt(3)\/2; yH &lt;= 600; yH += 2*s*sqrt(3)\/2){\n            fill(0, 0, 95)\n            hexagon(xH, yH);\n        }\n    }\n\n\n    \/\/Solar Systems\n    for(x = 100; x &lt;= width; x += 200){\n        for(y = 85; y &lt;=height; y += 300){\n            solarSystem();\n        }\n    }\n    for(x = 0; x &lt;= width; x += 200){\n        for(y = 235; y &lt;= height; y += 300){\n            solarSystem();\n        }\n    }\n\n    \/\/Yellow Stars\n    for(xS1 = -7; xS1 &lt;= width; xS1 += 200){\n        for(yS1 = 45; yS1 &lt;=height; yS1 += 300){\n            star();\n        }\n    }\n    for(xS1 = 93; xS1 &lt;= width; xS1 += 200){\n        for(yS1 = 195; yS1 &lt;= height; yS1 += 300){\n            star();\n        }\n    }\n\n    \/\/Pink Stars\n     for(xS2 = -7; xS2 &lt;= width; xS2 += 200){\n        for(yS2 = 115; yS2 &lt;=height; yS2 += 300){\n            star();\n        }\n    }\n    for(xS2 = 93; xS2 &lt;= width; xS2 += 200){\n        for(yS2 = 265; yS2 &lt;= height; yS2 += 300){\n            star();\n        }\n    }\n}\n\nfunction star() {\n    \/*\n    This function draws yellow and pink stars.\n    The star is made out of a square in the middle and 4\n    triangles that surround that square.\n    *\/\n\n    \/\/Yellow Star\n    noStroke();\n    fill(255, 255, 102);\n    rect(xS1, yS1, 13, 13);\n    triangle(xS1, yS1, xS1+6.5, yS1-13, xS1+13, yS1);\n    triangle(xS1, yS1, xS1-13, yS1+6.5, xS1, yS1+13);\n    triangle(xS1, yS1+13, xS1+6.5, yS1+26, xS1+13, yS1+13);\n    triangle(xS1+13, yS1, xS1+26, yS1+6.5, xS1+13, yS1+13);\n\n    \/\/Pink Star\n    noStroke();\n    fill(255, 178, 153);\n    rect(xS2, yS2, 13, 13);\n    triangle(xS2, yS2, xS2+6.5, yS2-13, xS2+13, yS2);\n    triangle(xS2, yS2, xS2-13, yS2+6.5, xS2, yS2+13);\n    triangle(xS2, yS2+13, xS2+6.5, yS2+26, xS2+13, yS2+13);\n    triangle(xS2+13, yS2, xS2+26, yS2+6.5, xS2+13, yS2+13);\n}\n\nfunction solarSystem() {\n    \/*\n    This function draws Solar System with sun in the middle\n    and planets rotating around the sun on their orbits.\n    *\/\n    \n    \/\/Orbits\n    stroke(255);\n    fill(0, 0, 0, 0);\n    ellipse(x, y, 25, 25);\n    ellipse(x, y, 45, 45);\n    ellipse(x, y, 65, 65);\n\n    push();\n    strokeWeight(3);\n    stroke(180);\n    ellipse(x, y, 85, 85);\n    pop();\n    ellipse(x, y, 105, 105);\n\n    ellipse(x, y, 125, 125);\n    ellipse(x, y, 145, 145);\n    ellipse(x, y, 165, 165);\n\n\n    \/\/Sun\n    noStroke();\n    fill(255, 255, 0);\n    ellipse(x, y, 12, 12);\n\n    \/\/Venus\n    noStroke();\n    fill(160, 160, 160);\n    ellipse(x+8, y+10, 8, 8);\n\n    \/\/Earth\n    noStroke();\n    fill(0, 102, 204);\n    ellipse(x+10, y-20, 13, 13);\n    fill(0,220,0);\n    ellipse(x+11, y-22, 8, 4);\n    ellipse(x+11, y-17, 4, 2.5);\n    ellipse(x+7, y-19, 5, 2);\n\n    \/\/Mars\n    noStroke();\n    fill(204, 65, 0);\n    ellipse(x-30, y-10, 12, 12);\n\n    \/\/Jupiter\n    noStroke();\n    fill(255, 155, 0);\n    ellipse(x+40, y+35, 18, 18);\n    stroke(195, 0, 0);\n    line(x+35, y+28, x+48, y+34);\n    stroke(205, 50, 0);\n    line(x+32, y+33, x+46, y+40);\n\n    \/\/Saturn\n    stroke(255);\n    fill(0, 0, 0, 0);\n    ellipse(x+37, y-50, 30, 9);\n    noStroke();\n    fill(190, 190, 190);\n    ellipse(x+37, y-50, 16.5, 16.5);\n\n    \/\/Uranus\n    noStroke();\n    fill(153, 204, 255);\n    ellipse(x-53, y+50, 15, 15);\n\n    \/\/Neptune\n    noStroke();\n    fill(10, 76, 153);\n    ellipse(x-45, y-70, 15, 15);\n}\n\n\nfunction hexagon(xH,yH){\n    \/*\n    This function draws one hexagon with a side of 8 pixels \n    that is made out of 8 triangles.\n    *\/\n    push();\n    translate(xH,yH)\n    noStroke();\n    triangle(0,0,-s,0,-s\/2,-s*sqrt(3)\/2)\n    triangle(0,0,-s\/2,-s*sqrt(3)\/2,s\/2,-s*sqrt(3)\/2)\n    triangle(0,0,s,0,s\/2,-s*sqrt(3)\/2)\n    triangle(0,0,-s,0,-s\/2,s*sqrt(3)\/2)\n    triangle(0,0,-s\/2,s*sqrt(3)\/2,s\/2,s*sqrt(3)\/2)\n    triangle(0,0,s,0,s\/2,s*sqrt(3)\/2)\n    pop();\n}\n\n\n\n<\/code><\/pre><\/p>|\n\n\n\n<figure class=\"wp-block-image size-large\"><img loading=\"lazy\" width=\"1024\" height=\"918\" src=\"https:\/\/courses.ideate.cmu.edu\/15-104\/f2021\/wp-content\/uploads\/2021\/10\/AF104B70-2F73-4838-8A8C-F9EA36C5DD21-1024x918.jpeg\" alt=\"\" class=\"wp-image-66958\" srcset=\"https:\/\/courses.ideate.cmu.edu\/15-104\/f2021\/wp-content\/uploads\/2021\/10\/AF104B70-2F73-4838-8A8C-F9EA36C5DD21-1024x918.jpeg 1024w, https:\/\/courses.ideate.cmu.edu\/15-104\/f2021\/wp-content\/uploads\/2021\/10\/AF104B70-2F73-4838-8A8C-F9EA36C5DD21-300x269.jpeg 300w, https:\/\/courses.ideate.cmu.edu\/15-104\/f2021\/wp-content\/uploads\/2021\/10\/AF104B70-2F73-4838-8A8C-F9EA36C5DD21-768x688.jpeg 768w, https:\/\/courses.ideate.cmu.edu\/15-104\/f2021\/wp-content\/uploads\/2021\/10\/AF104B70-2F73-4838-8A8C-F9EA36C5DD21-1536x1377.jpeg 1536w, https:\/\/courses.ideate.cmu.edu\/15-104\/f2021\/wp-content\/uploads\/2021\/10\/AF104B70-2F73-4838-8A8C-F9EA36C5DD21-2048x1836.jpeg 2048w, https:\/\/courses.ideate.cmu.edu\/15-104\/f2021\/wp-content\/uploads\/2021\/10\/AF104B70-2F73-4838-8A8C-F9EA36C5DD21-1200x1076.jpeg 1200w\" sizes=\"(max-width: 709px) 85vw, (max-width: 909px) 67vw, (max-width: 1362px) 62vw, 840px\"><\/figure><p>This project was very interesting in the fact that I get to design whatever I want which also made this project hard as if it was hard to stop on one idea only. I came up with the idea of Solar system with planets surrounding a sun in the middle. All of the systems are identical and are separated by yellow and pink stars. <\/p><\/body><\/html>\n","protected":false},"excerpt":{"rendered":"<p>sketchDownload \/* Yanina Shavialenka Section B yshavial@andrew.cmu.edu Project 5: Wallpaper *\/ var x = 100; var y = 45; var s = 8; var xS1 = 193; var yS1 = 60; var xS2 = 193; var yS2 = 115; function setup() { createCanvas(600, 600); background(0, 0, 51); text(&#8220;p5.js vers 0.9.0 test.&#8221;, 10, 15); } function &hellip; <a href=\"https:\/\/courses.ideate.cmu.edu\/15-104\/f2021\/2021\/10\/02\/wallpaper-project\/\" class=\"more-link\">Continue reading<span class=\"screen-reader-text\"> &#8220;Wallpaper Project&#8221;<\/span><\/a><\/p>\n","protected":false},"author":670,"featured_media":0,"comment_status":"open","ping_status":"closed","sticky":false,"template":"","format":"standard","meta":[],"categories":[104,56],"tags":[],"_links":{"self":[{"href":"https:\/\/courses.ideate.cmu.edu\/15-104\/f2021\/wp-json\/wp\/v2\/posts\/66943"}],"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\/670"}],"replies":[{"embeddable":true,"href":"https:\/\/courses.ideate.cmu.edu\/15-104\/f2021\/wp-json\/wp\/v2\/comments?post=66943"}],"version-history":[{"count":4,"href":"https:\/\/courses.ideate.cmu.edu\/15-104\/f2021\/wp-json\/wp\/v2\/posts\/66943\/revisions"}],"predecessor-version":[{"id":66960,"href":"https:\/\/courses.ideate.cmu.edu\/15-104\/f2021\/wp-json\/wp\/v2\/posts\/66943\/revisions\/66960"}],"wp:attachment":[{"href":"https:\/\/courses.ideate.cmu.edu\/15-104\/f2021\/wp-json\/wp\/v2\/media?parent=66943"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/courses.ideate.cmu.edu\/15-104\/f2021\/wp-json\/wp\/v2\/categories?post=66943"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/courses.ideate.cmu.edu\/15-104\/f2021\/wp-json\/wp\/v2\/tags?post=66943"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}