{"id":76052,"date":"2022-11-20T21:27:50","date_gmt":"2022-11-21T02:27:50","guid":{"rendered":"https:\/\/courses.ideate.cmu.edu\/15-104\/f2022\/?p=76052"},"modified":"2022-11-20T21:36:14","modified_gmt":"2022-11-21T02:36:14","slug":"srishtys-project-11","status":"publish","type":"post","link":"https:\/\/courses.ideate.cmu.edu\/15-104\/f2022\/2022\/11\/20\/srishtys-project-11\/","title":{"rendered":"Srishty&#8217;s Project 11"},"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>The Sushi Bar Train<\/p>\n\n\n\n<p>For my project I decided to create a restaurant on a train that serves japanese food via a conveyer belt. The dishes include: sashimi, tuna sushi, matcha, miso soup, ramen, and salmon. In the window of the train booth, you can watch as you travel through a bright city at night.<\/p>\n\n\n\n<p><a p=\"\" class=\"p5_sketch_link\" data-width=\"480\" data-height=\"480\" href=\"https:\/\/courses.ideate.cmu.edu\/15-104\/f2022\/wp-content\/uploads\/2022\/11\/sketch-77.js\">Sushi Bar Train<\/a><a href=\"https:\/\/courses.ideate.cmu.edu\/15-104\/f2022\/wp-content\/uploads\/2022\/11\/sketch-77.js\" class=\"wp-block-file__button\" download=\"\" aria-describedby=\"wp-block-file--media-ed04f63f-08da-4a4d-a049-699346ff19cd\">Download<\/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\">\/\/ SRISHTY BHAVSAR \n\/\/ 15104 SECTION C\n\/\/PROJECT 11\n\nvar buildings = [];\n\nvar fd = [] \/\/ \n\n\/\/ food items\nvar ramen; \/\/ https:\/\/imgur.com\/H2R30Wg\nvar miso; \/\/ https:\/\/imgur.com\/J5EhmuM\nvar salmon; \/\/ https:\/\/imgur.com\/p6YrdLv\nvar sashimi;  \/\/ https:\/\/imgur.com\/mJjnmVD\nvar matcha; \/\/ https:\/\/imgur.com\/SErtIMf\nvar tunasushi; \/\/ https:\/\/imgur.com\/HCUsYNh\nvar maki; \/\/ https:\/\/imgur.com\/UI5eghR\n\nvar food = \n[\"https:\/\/i.imgur.com\/H2R30Wg.png\", \"https:\/\/i.imgur.com\/J5EhmuM.png\", \n \"https:\/\/i.imgur.com\/p6YrdLv.png\", \"https:\/\/i.imgur.com\/mJjnmVD.png\", \n \"https:\/\/i.imgur.com\/SErtIMf.png\" , \"https:\/\/i.imgur.com\/HCUsYNh.png\", \n \"https:\/\/i.imgur.com\/UI5eghR.png\"]; \/\/ food contains the images of ramen,miso,salmon,etc.\n\n\nfunction preload() {\n\n    seats = loadImage(\"https:\/\/i.imgur.com\/UEAssld.png\");\n\n\n    ramen = loadImage(food[0]); \/\/ramen\n    miso = loadImage(food[1]); \/\/miso\n    salmon = loadImage(food[2]); \/\/ salmon\n    sashimi = loadImage(food[3]); \/\/sashimi\n    matcha = loadImage(food[4]); \/\/matcha\n    tunasushi = loadImage(food[5]); \/\/tunasushi\n    maki = loadImage(food[6]); \/\/maki\n\n\n\n    bg = loadImage(\"https:\/\/i.imgur.com\/2zjN6qS.png\");\n\n}\n\nfunction setup() {\n    createCanvas(480, 480);\n    background(220);\n    imageMode(CENTER);\n    frameRate(17);\n\n    \/\/ create an initial collection of buildings\n    for (var i = 0; i &lt; 20; i++) {\n        var rx = random(width);\n        buildings[i] = makeBuilding(rx);\n        \n    }\n\n\n    \/\/ collection of dishes\n    var dist = 0;\n    for (var i = 0; i &lt;500; i++) {\n        fd[i] = makeFood(dist);\n        dist += 150; \/\/distance between dishes\n    }\n    print(fd);\n\n}\n\nfunction draw() {\n    createCanvas(480, 480);\n    background(25,25,112);\n\n\n    \/\/buildings\n    push();\n    translate(0,-120);\n    updateAndDisplayBuildings();\n    removeBuildingsThatHaveSlippedOutOfView();\n    addNewBuildingsWithSomeRandomProbability(); \n    pop();\n\n    \/\/bg\n    image(bg, 266.4269, 240, 532.8539, 480);\n\n    showFood();\n\n    \/\/seats\n    image(seats,240,408.3845,480,143.231);\n\n\n\n\n}\n\n\nfunction makeFood(xloc){\n    var fd = { x: xloc,\n                speedx: 1.5,\n                move: foodMove, \n                food : random([ramen, miso, salmon, sashimi, matcha, tunasushi, maki]),\n                display: foodDisplay,\n                }\n    return fd;\n}\n\n\nfunction foodDisplay(){\n\n    \/*the width heights and y location are respective to the \n    ones mapped out on adobe illustrator. thats why they are typed manually *\/\n    \/\/xloc is the speed times 500 and the dist\n    if (this.food == ramen){\n        image(ramen,this.x -750*20, 310, 148, 108 );  \/\/ ramen\n    }\n    if (this.food == miso){\n        image(miso,this.x  -750*20, 310, 119, 115 ); \/\/ miso\n    }\n    if (this.food == salmon){\n        image(salmon,this.x -750*20, 318, 174, 126 ); \/\/ salmon\n    }\n    if (this.food == sashimi){\n        image(sashimi,this.x -750*20, 309, 203, 147 ); \/\/sashimi\n    }\n    if (this.food == matcha){\n        image(matcha,this.x - 750*20, 324, 119, 86 ); \/\/ matcha\n    }\n    if (this.food == tunasushi){\n        image(tunasushi,this.x  -750*20, 318, 164, 119); \/\/tuna\n    }\n    if (this.food == maki){\n        image(maki,this.x  -750*20, 294, 247, 179 ); \/\/maki\n    }\n}\n\n\/\/speed of moving food\nfunction foodMove() {\n    this.x += this.speedx;  \n}\n\n\/\/calling show and move function of dishes\nfunction showFood(){\n    for( var i = 0; i &lt; fd.length; i++ ) {\n        fd[i].display();\n        fd[i].move();\n        if ( i == fd.length){\n            textSize(15);\n            text('Sushi Bar closed. No more food for today!', 100, 200);\n        }\n    }\n\n}\n\n\n\nfunction makeBuilding(birthLocationX) {\n    var bldg = {x: birthLocationX,\n                breadth: 30,\n                speed: -1.0,\n                nFloors: round(random(2,8)),\n                move: buildingMove,\n                color: color(random(255),random(255), random(255), 80), \/\/ random color buildings with low opacity to look distant\n                display: buildingDisplay\n            } \n    return bldg;\n}\n\n\nfunction updateAndDisplayBuildings(){\n    \/\/ Update the building's positions, and display them.\n    for (var i = 0; i &lt; buildings.length; i++){\n        buildings[i].move();\n        buildings[i].display();\n    }\n}\n\n\nfunction removeBuildingsThatHaveSlippedOutOfView(){\n\n    var buildingsToKeep = [];\n    for (var i = 0; i &lt; buildings.length; i++){\n        if (buildings[i].x + buildings[i].breadth &gt; 0) {\n            buildingsToKeep.push(buildings[i]);\n        }\n    }\n    buildings = buildingsToKeep; \/\/ remember the surviving buildings\n}\n\n\nfunction addNewBuildingsWithSomeRandomProbability() {\n    \/\/ With a very tiny probability, add a new building to the end.\n    var newBuildingLikelihood = 0.007; \n    if (random(0,1) &lt; newBuildingLikelihood) {\n        buildings.push(makeBuilding(width));\n    }\n}\n\n\n\/\/ method to update position of building every frame\nfunction buildingMove() {\n    this.x += this.speed;\n}\n    \n\n\/\/ draw the building and some windows\nfunction buildingDisplay() {\n    var floorHeight = 20;\n    var bHeight = this.nFloors * floorHeight; \n    fill(this.color); \n    push();\n    translate(this.x, height - 40);\n    strokeWeight(0);\n    rect(0, -bHeight, this.breadth, bHeight);\n    for (var i = 0; i &lt; this.nFloors; i++) {\n        rect(5, -15 - (i * floorHeight), this.breadth - 10, 10);\n    }\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=\"517\" src=\"https:\/\/courses.ideate.cmu.edu\/15-104\/f2022\/wp-content\/uploads\/2022\/11\/IMG_2469-1024x517.jpg\" alt=\"\" class=\"wp-image-76061\" srcset=\"https:\/\/courses.ideate.cmu.edu\/15-104\/f2022\/wp-content\/uploads\/2022\/11\/IMG_2469-1024x517.jpg 1024w, https:\/\/courses.ideate.cmu.edu\/15-104\/f2022\/wp-content\/uploads\/2022\/11\/IMG_2469-300x152.jpg 300w, https:\/\/courses.ideate.cmu.edu\/15-104\/f2022\/wp-content\/uploads\/2022\/11\/IMG_2469-768x388.jpg 768w, https:\/\/courses.ideate.cmu.edu\/15-104\/f2022\/wp-content\/uploads\/2022\/11\/IMG_2469-1536x776.jpg 1536w, https:\/\/courses.ideate.cmu.edu\/15-104\/f2022\/wp-content\/uploads\/2022\/11\/IMG_2469-1200x606.jpg 1200w, https:\/\/courses.ideate.cmu.edu\/15-104\/f2022\/wp-content\/uploads\/2022\/11\/IMG_2469.jpg 1950w\" sizes=\"(max-width: 709px) 85vw, (max-width: 909px) 67vw, (max-width: 1362px) 62vw, 840px\"><\/figure><\/body><\/html>\n","protected":false},"excerpt":{"rendered":"<p>The Sushi Bar Train For my project I decided to create a restaurant on a train that serves japanese food via a conveyer belt. The dishes include: sashimi, tuna sushi, matcha, miso soup, ramen, and salmon. In the window of the train booth, you can watch as you travel through a bright city at night. &hellip; <a href=\"https:\/\/courses.ideate.cmu.edu\/15-104\/f2022\/2022\/11\/20\/srishtys-project-11\/\" class=\"more-link\">Continue reading<span class=\"screen-reader-text\"> &#8220;Srishty&#8217;s Project 11&#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":[115,57,1],"tags":[61],"_links":{"self":[{"href":"https:\/\/courses.ideate.cmu.edu\/15-104\/f2022\/wp-json\/wp\/v2\/posts\/76052"}],"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=76052"}],"version-history":[{"count":3,"href":"https:\/\/courses.ideate.cmu.edu\/15-104\/f2022\/wp-json\/wp\/v2\/posts\/76052\/revisions"}],"predecessor-version":[{"id":76068,"href":"https:\/\/courses.ideate.cmu.edu\/15-104\/f2022\/wp-json\/wp\/v2\/posts\/76052\/revisions\/76068"}],"wp:attachment":[{"href":"https:\/\/courses.ideate.cmu.edu\/15-104\/f2022\/wp-json\/wp\/v2\/media?parent=76052"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/courses.ideate.cmu.edu\/15-104\/f2022\/wp-json\/wp\/v2\/categories?post=76052"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/courses.ideate.cmu.edu\/15-104\/f2022\/wp-json\/wp\/v2\/tags?post=76052"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}