jihoonp_project_10

sketch

/*
Jihoon Park
Section A
jihoonp@andrew.cmu.edu
inClass 10.25
*/
var clouds = [];
var balloons = [];
var stork = [];


function setup() {
    createCanvas(400,600);
    
    for (var i=0; i<15; i++) {                      //initial placement of clouds
        var cloudsX = random(width);
        var cloudsY = random(height);
        clouds[i] = makeClouds(cloudsX, cloudsY);
    }

    for (var i=0; i<5; i++) {                        //initial placement of storks
        var storkX = random(width);
        var storkY = random(100, 500);
        stork[i] = makeStork(storkX, storkY);
    }

      for (var i=0; i<3; i++) {                      //initial placement of balloons
        var balloonX = random(width);
        var balloonY = random(height);
        balloons[i] = makeBalloons(balloonX, balloonY);
    }
    frameRate(10);

}

function draw() {
    background(132, 181, 204);          //sky blue background


    showClouds();
    deleteClouds();
    makeNewClouds();

    showBalloons();
    deleteBalloons();
    makeNewBalloons();

    showStork();
    deleteStork();
    makeNewStork();

    myBalloon();

}

//---------------------------FUNCTIONS THAT MAKE CLOUDS--------------------------------------------------
function showClouds() {                                      //this makes the clouds move down
    for(var i=0; i<clouds.length; i++) {
        clouds[i].move();
        clouds[i].display();
    }
}

function deleteClouds() {                                    //deletes clouds that disappear from sight
    var cloudsToKeep = [];
    for (var i=0; i< clouds.length; i++) {
        if(clouds[i].y >600) {
            cloudsToKeep.push(clouds[i]);
        }
    }
}

function makeNewClouds() {                                   //creates more clouds coming down
    var newCloudLiklihood =0.05
    if (random(0,1) < newCloudLiklihood) {
        clouds.push(makeClouds(random(width), 0));
    }
}

function cloudMove() {                                      //sets the move property of clouds
    this.y += this.speed;
}

function cloudDisplay() {                                   //what clouds look like
    var cloudSize=this.cloudSize;
    fill(223, 255, 233);
    noStroke();
    push();                                                         //moves the center point to center of cloud
    translate(this.x, this.y);
    ellipse(0, 0, cloudSize, cloudSize);                            //graphic elements of clouds
    ellipse(0, cloudSize, 3*cloudSize, cloudSize);
    ellipse(-cloudSize/2, cloudSize/2, cloudSize, cloudSize);
    ellipse(cloudSize/2, cloudSize/2, cloudSize, cloudSize);
    pop();
}
    
function makeClouds(birthLocationX, birthLocationY) {       //function that makes the clouds
    var clouds = {x : birthLocationX,                                  //clouds are born in random places
                y : birthLocationY, 
                speed : random(1, 5),                                //sets random speed of clouds
                cloudSize : random(10, 25),                          //sets random size of clouds
                move : cloudMove,  
                display : cloudDisplay}
    return clouds;
}
//-------------------------------------------------------------------------------------------------------

//---------------------------FUNCTIONS THAT MAKE STORK---------------------------------------------------
function showStork() {                                      //this makes the stork move left
    for(var i=0; i<stork.length; i++) {
        stork[i].fly();
        stork[i].display();
    }
}

function deleteStork() {                                    //deletes stork that disappear from sight
    var storkToKeep = [];
    for (var i=0; i< stork.length; i++) {
        if(stork[i].x <0) {
            storkToKeep.push(stork[i]);
        }
    }
}

function makeNewStork() {                                   //creates more stork coming from left
    var newStorkLiklihood =0.03
    if (random(0,1) < newStorkLiklihood) {
        stork.push(makeStork(650, random(100, 500)));
    }
}
function storkFly() {
    this.x += this.speed;
}

function storkDisplay() {                       //makes graphic elements of the Stork
    
    push();
    translate(this.x, this.y);
    stroke(140);
    strokeWeight(1);
    fill(255, 220, 98);
    triangle(-50, 1, -4, -3, -4, 3);     //makes beak
    line(-50, 0, -4,0);

    strokeWeight(2);                    //makes legs
    line(70, 7, 110, 15);
    line(110, 15, 117, 10);
    line(110, 15, 120, 15);
    line(110, 15, 117, 20);

    noStroke();
    fill(243, 239, 244);
    ellipse(0, 0, 20, 20);              //makes head

    ellipse(50, 0, 50, 20);             //makes body

    beginShape();                       //makes wings
    curveVertex(40, 0);
    curveVertex(40, 0);
    curveVertex(60, -40);
    curveVertex(80, -40);
    curveVertex(60, 0);
    curveVertex(60, 0);
    endShape();

    strokeWeight(6);
    stroke(243, 239, 244);
    line(5,0, 25, 0);                   //makes neck

    fill(0);
    noStroke();
    stroke(0);
    ellipse(0, -2, .2, .2);           //makes eyes
    pop();
}

function makeStork(birthLocationX, birthLocationY) {
    var stork = {x : birthLocationX,
                y : birthLocationY,
                speed : -random(2, 6),
                fly : storkFly,
                display : storkDisplay}
    return stork;
}
//-------------------------------------------------------------------------------------------------------

function showBalloons() {                                      //this makes the balloons move up
    for(var i=0; i<balloons.length; i++) {
        balloons[i].move();
        balloons[i].display();
    }
}

function deleteBalloons() {                                    //deletes Balloons that disappear from sight
    var BalloonsToKeep = [];
    for (var i=0; i< balloons.length; i++) {
        if(balloons[i].y >600) {
            balloonsToKeep.push(balloons[i]);
        }
    }
}

function makeNewBalloons() {                                   //creates more Balloons coming down
    var newBalloonLiklihood =0.05
    if (random(0,1) < newBalloonLiklihood) {
        balloons.push(makeBalloons(random(width), 600));
    }
}

function balloonMove() {                                      //sets the move property of Ballons
    this.y += this.speed;
}

function balloonDisplay() {
    push();
    translate(this.x, this.y);
    fill(173, 140, 82);
    stroke(105, 84, 49);
    strokeWeight(3);

    beginShape();           //basket
    vertex(-7, -7);
    vertex(7, -7);
    vertex(5, 5);
    vertex(-5, 5);
    endShape(CLOSE);

    stroke(30, 40, 20);
    strokeWeight(2);
    line(-7, -7, -10, -20);
    line(7, -7, 10, -20);

    strokeWeight(.5);
    fill(255, 97, 118);
    ellipse(0, -30, 30, 30);
    pop();


}

function makeBalloons(birthLocationX, birthLocationY) {
    var balloon = {x : birthLocationX,
                   y : birthLocationY,
                   speed : -random(1, 6),
                   move : balloonMove,
                   display : balloonDisplay}
    return balloon;
}

//---------------------------FUNCTION THAT MAKES MY BALLOON----------------------------------------------
function myBalloon() {                                 //function makes the balloon im in in perspective
                                        //basket
    fill(105, 84, 49);
    strokeWeight(10);
    stroke(173, 140, 82);
    beginShape();
    vertex(0, 610);
    vertex(50, 520);
    vertex(350, 520);
    vertex(400,610);
    endShape(CLOSE);
                                        //rope
    stroke(30, 39, 20);
    strokeWeight(5);
    line(50,515, 20,70);
    line(350,515, 380, 70);
                                        //balloon
    fill(255, 224, 151);
    strokeWeight(1);
    stroke(140);
    beginShape();
    curveVertex(200,-100);
    curveVertex(50, -50);
    curveVertex(-30, 100);
    curveVertex(200, 50);
    curveVertex(430, 100);
    curveVertex(350, -50);
    curveVertex(200, -100);
    endShape(CLOSE);

    fill(255, 161, 193);
    beginShape();
    curveVertex(-30, 100)
    curveVertex(0, 100);
    curveVertex(20,70);
    curveVertex(50, -50);
    curveVertex(-30, 0);
    endShape(CLOSE);

    fill(204, 125, 178);
    beginShape();
    curveVertex(430, 100)
    curveVertex(400, 100);
    curveVertex(380, 70);
    curveVertex(350, -50);
    curveVertex(430, 0);
    endShape(CLOSE);
}

I created a perspective view from a hot balloon going up into the air. clouds’s downward movement makes an illusion that the viewer is going up while size variation gives the sky a sense of depth. To add more fun, a flock of storks appear as well as other balloons.
img_0855-%ec%82%ac%eb%b3%b8

Grace Cha – Project 10- Landscape

I’ve always thought that looking outside the widow on an airplane flight was a special moment of peace and aww. I wanted to capture this feeling with the use of soft plum colors, circular clouds and a starry night.  My process consisted of planning out the star nights to look as realistic as possible by picking really small points and adding a natural looking gradient to the back.

screen-shot-2016-11-03-at-10-59-10-pm

img_2277

sketch

//Grace Cha
//Section C
//heajinc
//Project 10

var stars = [];
var clouds = [];

function setup() {
    createCanvas(600,400); 
    for (var s = 0; s < 3000; s++) {
        stars.push(new Star());
    }

    // create an initial collection of clouds
    for (var i = 0; i < 10; i++){
        var rx = random(width);
        clouds[i] = makeCloud(rx);

    }
    frameRate(45);
}


function draw() {

    Sky(0, 0, width, height);
    DrawStar();

    updateAndDisplayClouds();
    removeCloudsThatHaveSlippedOutOfView();
    addNewCloudsWithSomeRandomProbability();
    

    airplaneInterior();
    
    
}


function Sky(x, y, w, h) {
    //Draws the gradient sky
    var c1, c2;
    
    c1 = color("#7B75C3");
    c2 = color("#F8B09A");
    for (var i = y; i <= y + h; i++) {
        var inter = map(i, y, y + h, 0, 1);
        var c = lerpColor(c1, c2, inter);
        stroke(c);
        line(x, i, x + w, i);
    
    }
}

function Star() {
    //Draws the randomized stars

    this.x = random(width);
    this.y = random(height);
    this.diameter = 0.005;
    this.di = 0.005;
    this.speed = 0.05;//virtually very small speed
    this.border = random(0, 0.5);
    this.vol = 0;
    
    this.move = function() {
    this.x += random(-this.speed, this.speed + this.vol);
    this.di = this.di +this.vol;

    var prob = random(0, 1);
    if (this.di <= 0.16) {
      this.vol = 0.001;
    }else if(this.di>=0.16){
    this.vol=0;
}


  }

  this.display = function() {
    strokeWeight(this.border);
    stroke(255);
    fill(255);
    ellipse(this.x, this.y,  this.di,  this.di);

  }
}


function DrawStar() {
  for (var i = 0; i < stars.length; i++) {
    stars[i].move();
    stars[i].display();
  }
}

function airplaneInterior(){

    beginShape();
    noStroke();
    fill("#5F4B92");
    vertex(257,133);
    vertex(283,110);
    vertex(318,133);
    endShape();

    beginShape();
    noStroke();
    fill("#5F4B92");
    vertex(158,171);
    vertex(200,137);
    vertex(252,166);
    endShape();

    //wing
    beginShape();
    noStroke();
    fill("#715E92");
    vertex(-30,276);
    vertex(0,162);
    vertex(335,92);
    vertex(377,38);
    vertex(362, 93);
    vertex(126,183);
    endShape();

    //Red Airplane sign
    beginShape();
    fill("#A2567D");
    vertex(345, 89);
    vertex(373,54);
    vertex(363,89);
    endShape();
  
    //Window
    push();
    strokeWeight(10);
    fill("#303053");
    stroke("#9E8DB3")
    beginShape();
    curveVertex(-5,146);
    curveVertex(-5,146);
    curveVertex(150,339);
    curveVertex(369,392);
    curveVertex(544,297);
    curveVertex(600,200);
    curveVertex(607,183);
    curveVertex(600,400);
    curveVertex(0,600);
    curveVertex(0,600);
    endShape();
    pop();
    push();
    
    //inside Window panel
    beginShape();
    fill("#6B659C");
    curveVertex(0,218);
    curveVertex(0,218);
    curveVertex(101,338);
    curveVertex(316,460);
    curveVertex(66,425);
    curveVertex(0,365);
    curveVertex(0,365);
    endShape();
    pop();
 
}

function updateAndDisplayClouds(){
    for (var i = 0; i < clouds.length; i++){
        clouds[i].move();
        clouds[i].display();
    }
}


function removeCloudsThatHaveSlippedOutOfView(){
    
    var cloudsToKeep = [];
    for (var i = 0; i < clouds.length; i++){
        if (clouds[i].x + clouds[i].breadth > 0) {
            cloudsToKeep.push(clouds[i]);
        }
    }
    clouds = cloudsToKeep; // remember the surviving clouds
}


function addNewCloudsWithSomeRandomProbability() {
    
    var newBuildingLikelihood = 0.007; 
    if (random(0,1) < newBuildingLikelihood) {
        clouds.push(makeCloud(width));
    }
}



function buildingMove() {
    this.x += this.speed;
}
    


function buildingDisplay() {
    var floorHeight = 10;
    var bHeight = this.nFloors * floorHeight; 
    
    fill(255,90); 
    noStroke(); 
    push();
    translate(this.x, height - 40);
    ellipse(120, -bHeight + 30, this.breadth, bHeight/2);
    pop();

    push();
    fill(255,20)
    translate(this.x, height - 40);
    ellipse(30, - bHeight -200, this.breadth, bHeight);
    pop();
}


function makeCloud(birthLocationX) {
    var bldg = {x: birthLocationX,
                breadth: random(100, 300),
                speed: -random(1,3),
                nFloors: round(random(2,10)),
                move: buildingMove,
                display: buildingDisplay}
    return bldg;
}

 

 

 

Kyle Lee Project 10

For my project, I decided to make my landscape out of numerical elements. As the landscape changes, so do the numbers. I used noise functions to build the terrain and random floor numbers to create the numbers. To keep the numbers from drawing on every X value, I used an if statement and a % to spread the numbers out across the canvas width.

img_4186kdlee-project-10

//Kyle Lee
//Section C
//kdlee@andrew.cmu.edu
//Project-10

var terrainSpeed = 0.0005;
var terrainDetail = 0.005;

function setup() {
    createCanvas(640, 240);
    frameRate(25);
}

function draw() {
    background(255);
    for (var x = 0; x < width; x++) {
        var t = (x * terrainDetail) + (millis() * terrainSpeed);
        var y = map(noise(t), 0,1, 0, height);
        var integer = floor(random(0, 9));
        stroke(0);
        if(x%8 == 0){
            text(integer, x, y)
        }
    }
    noFill();
    rect(0, 0, width - 1, height - 1);
}