{"id":69088,"date":"2021-11-14T21:29:57","date_gmt":"2021-11-15T02:29:57","guid":{"rendered":"https:\/\/courses.ideate.cmu.edu\/15-104\/f2021\/?p=69088"},"modified":"2021-11-14T21:29:57","modified_gmt":"2021-11-15T02:29:57","slug":"project-11-2","status":"publish","type":"post","link":"https:\/\/courses.ideate.cmu.edu\/15-104\/f2021\/2021\/11\/14\/project-11-2\/","title":{"rendered":"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>this project was pretty interesting. there are birds, clouds, and a landscape going across the screen.<\/p>\n\n\n\n<div><a class=\"p5_sketch_link\" data-width=\"400\" data-height=\"400\" href=\"https:\/\/courses.ideate.cmu.edu\/15-104\/f2021\/wp-content\/uploads\/2021\/11\/sketch-55.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\">\nvar cloud = []\nvar bird = []\n\nfunction setup() {\n    createCanvas(480, 240)\n    frameRate(10)\n\n    for (i = 0; i &lt; 30; i++) {\n        birdX = random(width)\n        birdY = random(height)\n        bird[i] = makeBird(birdX, birdY)\n    }\n    for (i = 0; i &lt; 15; i++) {\n        cloudX = random(width)\n        cloudY = random(height\/1.5)\n        cloud[i] = makeCloud(cloudX, cloudY)\n    }\n}\n\nfunction draw() {\n    background(140, 200, 255)\n    strokeWeight(2)\n    landscape()\n    showCloud()\n    showBird()\n\n}\n\nfunction landscape() {\n    stroke(86, 125, 70)\n    beginShape()\n    for (var i = 0; i &lt; width; i++) {\n        var x = (i * .01) + (millis() * .0004)\n        var s = map(noise(x), 0, 1, 150, 200)\n        line(i, s, i, height)\n        \n    }\n    endShape()\n}\n\n\nfunction makeBird(birdX, birdY) {\n    var bird = {\n        fx: birdX,\n        fy: birdY,\n        birdspeed: random(-3, -8),\n        birdmove: moveBird,\n        birdcolor: color(random(100, 200), random(100, 200), random(100, 200)),\n        birddraw: drawBird\n    }\n    return bird\n}\n\nfunction moveBird() {\n    this.fx += this.birdspeed\n    if (this.fx &lt;= -10) {\n        this.fx += width\n    }\n}\n\nfunction drawBird() {\n    \n    stroke(0)\n    fill(this.birdcolor);\n    ellipse(this.fx, this.fy, 10, 10)\n    line(this.fx - 5, this.fy, this.fx - 10, this.fy - 2)\n    line(this.fx + 5, this.fy, this.fx + 10, this.fy - 2)\n\n}\n\nfunction showBird() {\n    for (i = 0; i &lt; bird.length; i++) {\n        bird[i].birdmove()\n        bird[i].birddraw()\n    }\n}\n\nfunction makeCloud(cloudX, cloudY) {\n    var cloud = {\n        fx: cloudX,\n        fy: cloudY,\n        cloudspeed: random(-1, -2),\n        cloudmove: moveCloud,\n        clouddraw: drawCloud\n    }\n    return cloud\n}\n\nfunction moveCloud() {\n    this.fx += this.cloudspeed\n    if (this.fx &lt;= -10) {\n        this.fx += width\n    }\n}\n\nfunction drawCloud() {\n    \n    noStroke()\n    fill(255);\n    ellipse(this.fx, this.fy, 10, 10)\n    ellipse(this.fx-4, this.fy-1, 10, 10)\n\n    \n\n}\n\nfunction showCloud() {\n    for (i = 0; i &lt; cloud.length; i++) {\n        cloud[i].cloudmove()\n        cloud[i].clouddraw()\n    }\n}<\/code><\/pre><\/div><\/body><\/html>\n","protected":false},"excerpt":{"rendered":"<p>this project was pretty interesting. there are birds, clouds, and a landscape going across the screen.<\/p>\n","protected":false},"author":659,"featured_media":0,"comment_status":"open","ping_status":"closed","sticky":false,"template":"","format":"standard","meta":[],"categories":[115,55,1],"tags":[],"_links":{"self":[{"href":"https:\/\/courses.ideate.cmu.edu\/15-104\/f2021\/wp-json\/wp\/v2\/posts\/69088"}],"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\/659"}],"replies":[{"embeddable":true,"href":"https:\/\/courses.ideate.cmu.edu\/15-104\/f2021\/wp-json\/wp\/v2\/comments?post=69088"}],"version-history":[{"count":1,"href":"https:\/\/courses.ideate.cmu.edu\/15-104\/f2021\/wp-json\/wp\/v2\/posts\/69088\/revisions"}],"predecessor-version":[{"id":69090,"href":"https:\/\/courses.ideate.cmu.edu\/15-104\/f2021\/wp-json\/wp\/v2\/posts\/69088\/revisions\/69090"}],"wp:attachment":[{"href":"https:\/\/courses.ideate.cmu.edu\/15-104\/f2021\/wp-json\/wp\/v2\/media?parent=69088"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/courses.ideate.cmu.edu\/15-104\/f2021\/wp-json\/wp\/v2\/categories?post=69088"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/courses.ideate.cmu.edu\/15-104\/f2021\/wp-json\/wp\/v2\/tags?post=69088"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}