{"id":75936,"date":"2022-11-20T02:47:58","date_gmt":"2022-11-20T07:47:58","guid":{"rendered":"https:\/\/courses.ideate.cmu.edu\/15-104\/f2022\/?p=75936"},"modified":"2022-11-20T02:47:58","modified_gmt":"2022-11-20T07:47:58","slug":"project-11-landscape-4","status":"publish","type":"post","link":"https:\/\/courses.ideate.cmu.edu\/15-104\/f2022\/2022\/11\/20\/project-11-landscape-4\/","title":{"rendered":"Project 11: Landscape"},"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><\/p>\n\n\n\n<p><a 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-70.js\">sketch-asu<\/a><a href=\"https:\/\/courses.ideate.cmu.edu\/15-104\/f2022\/wp-content\/uploads\/2022\/11\/sketch-70.js\"><\/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\">\/\/ Your name: Ashley Su\n\/\/ Your andrew ID: ashleysu\n\/\/ Your section (C):  \n\nvar Man;\nvar grass = 0.4;\nvar grassSpeed = 0.07;\nvar mountainFront = 0.008;\nvar mountainFrontSpeed = 0.0005;\nvar mountainBack = 0.01;\nvar mountainBackSpeed = 0.0002;\nvar bubbles = [];\n\n\nfunction setup() {\n    createCanvas(480, 480);\n    frameRate(20);\n\n\/\/ setting up bubble array \n\n    for (var i = 0; i &lt; 9; i++){                             \n            var bubblesX = random(width);\n            var bubblesY = random(0, 200);\n            bubbles[i] = makebubbles(bubblesY, bubblesX);\n        }\n}\n\nfunction draw(){\n    background(221,191,218);\n   \n    Sun();\n    MountainBack();\n    MountainFront();\n    Grass(); \n    image(Man,mouseX,300,80,80);\n    updatebubbles();\n    addbubbles();\n\n}\n\n\/\/ draw sun \n\nfunction Sun(){\n    noStroke();\n    fill(250,70,22,120);\n    ellipse(350, 200, mouseX+500);\n    fill(250,70,22,40);\n    ellipse(350, 200,  mouseX+350);\n    fill(250,70,22,100);\n    ellipse(350, 200,  mouseX+200);\n\n}\n\n\/\/pizza man loading\nfunction preload(){\n  Man = loadImage(\"https:\/\/i.imgur.com\/9AUtJm7.png\");\n}\n\n\n\/\/draws first mountain\nfunction MountainBack(){\n    noStroke();\n    fill(0,109,87);\n    beginShape();\n    for (var i = 0; i &lt; width; i ++){\n        var x = (i * mountainBack) + (millis() * mountainBackSpeed);\n        var y = map(noise(x), 0, 1.5, 50, 300);\n        vertex(i, y);\n    }\n    vertex(width, height);\n    vertex(0, height);\n    endShape();\n}\n\n\/\/ drawing second mountain in front of first mountain\nfunction MountainFront(){\n    noStroke();\n    fill(208,240,192);\n    beginShape();\n    for (var i = 0; i &lt; width; i ++){\n        var x = (i * mountainFront) + (millis() * mountainFrontSpeed);\n        var y = map(noise(x), 0, 1.2, 150, 250);\n        vertex(i, y);\n    }\n    vertex(width, height);\n    vertex(0, height);\n    endShape();\n}\n\n\/\/ draws the grass \nfunction Grass(){\n    noStroke();\n    fill(156,176,113);\n    beginShape();\n    for (var i = 0; i &lt; width; i ++){\n        var x = (i * grass) + (millis() * grassSpeed);\n        var y = map(noise(x), 0, 1.1, 350, 370);\n        vertex(i, y);\n    }\n    vertex(width, height);\n    vertex(0, height);\n    endShape();\n}\n\n\/\/constructing the bubbles as objects\nfunction makebubbles(bubblesX, bubblesY){\n    var bubbles = {\n        x: bubblesX,\n        y: bubblesY,\n        velocity: random(3, 8),\n        size: random(5, 15),\n        move: movebubbles,\n        show: showbubbles,\n    }\n    return bubbles;\n}\n\n\/\/ defining the speed of bubbles \nfunction movebubbles(){\n    this.x -= this.velocity;\n    this.y -= this.velocity \/ random(5, 20);\n}\n\n\/\/ defning bubbles characteristics\nfunction showbubbles(){\n    strokeWeight(1);\n    stroke('LightBlue');\n    fill(101,208,255,80);\n    circle(this.x, this.y, this.size);\n    curve(this.x + this.size, this.y, this.size, this.size\/2);\n}\n\n\/\/telling bubbbles to move on the screen\nfunction updatebubbles(){\n    for(i = 0; i &lt; bubbles.length; i++){\n        bubbles[i].move();\n        bubbles[i].show();\n    }\n}\n\n\/\/ making bubbles contiuesly move accross the screen\nfunction addbubbles(){\n    if (random(0,2) &lt; 0.5){\n        var bubblesX = width;\n        var bubblesY = random(0, height\/2);\n        bubbles.push(makebubbles(bubblesX, bubblesY));\n    }\n\n\n}\n<\/code><\/pre><\/p><\/body><\/html>\n","protected":false},"excerpt":{"rendered":"<p>sketch-asu \/\/ Your name: Ashley Su \/\/ Your andrew ID: ashleysu \/\/ Your section (C): var Man; var grass = 0.4; var grassSpeed = 0.07; var mountainFront = 0.008; var mountainFrontSpeed = 0.0005; var mountainBack = 0.01; var mountainBackSpeed = 0.0002; var bubbles = []; function setup() { createCanvas(480, 480); frameRate(20); \/\/ setting up bubble &hellip; <a href=\"https:\/\/courses.ideate.cmu.edu\/15-104\/f2022\/2022\/11\/20\/project-11-landscape-4\/\" class=\"more-link\">Continue reading<span class=\"screen-reader-text\"> &#8220;Project 11: Landscape&#8221;<\/span><\/a><\/p>\n","protected":false},"author":761,"featured_media":0,"comment_status":"open","ping_status":"closed","sticky":false,"template":"","format":"standard","meta":[],"categories":[115,57],"tags":[],"_links":{"self":[{"href":"https:\/\/courses.ideate.cmu.edu\/15-104\/f2022\/wp-json\/wp\/v2\/posts\/75936"}],"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\/761"}],"replies":[{"embeddable":true,"href":"https:\/\/courses.ideate.cmu.edu\/15-104\/f2022\/wp-json\/wp\/v2\/comments?post=75936"}],"version-history":[{"count":1,"href":"https:\/\/courses.ideate.cmu.edu\/15-104\/f2022\/wp-json\/wp\/v2\/posts\/75936\/revisions"}],"predecessor-version":[{"id":75941,"href":"https:\/\/courses.ideate.cmu.edu\/15-104\/f2022\/wp-json\/wp\/v2\/posts\/75936\/revisions\/75941"}],"wp:attachment":[{"href":"https:\/\/courses.ideate.cmu.edu\/15-104\/f2022\/wp-json\/wp\/v2\/media?parent=75936"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/courses.ideate.cmu.edu\/15-104\/f2022\/wp-json\/wp\/v2\/categories?post=75936"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/courses.ideate.cmu.edu\/15-104\/f2022\/wp-json\/wp\/v2\/tags?post=75936"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}