LookingOutward-10

For this weeks post, I decided to look at Allison Burtch’s project, Mic Jammer. In collaboration with Eric Rosenthal, Burtch created a small device that can mute people’s microphones. It works by emitting a high ultrasonic noise that is inaudible to human ears but can be heard by microphones.

Mic Jammer

I found this project interesting because of how relevant it is. Burtch describes the purpose of Mic Jammer as being like taping over your webcam, but for audio and microphones. Personally, I find that there is a growing fear of being watched through my webcam, but I never considered the possibility of being listened to through the microphone and this brings up that second possibility.

The product itself is in the beginning stages of being designed and Burtch as well comments on the fact that the next step is to collaborate with a product designer to re-engineer and design the product. I find it really interesting how the product was also designed around the iphone, specifically the iphone 4/5 and later iphone 6 when it came out. It considers the placement of the microphones (on the bottom for iphone 4/5 and two on top and two on bottom for iphone 6), trying to find best way to hit and aim for the microphones.

http://www.allisonburtch.net/mic-jammer/

aerubin-Project-10-Landscape

Van Gogh Starry Night

I was inspired by Van Gogh’s Starry Night painting. I thought it would be interesting to see what his painting would look like if it was animated, since he painted a sky with wind that was painted with the intention of motion. I made each aspect of the painting into different functions, so they would be easier to place when each part was complete. I utilized many for loops in order to achieve his brush stroke affect. All in all, I think my code provides insight into what the wind in his painting would look like if it could be animated.

sketch

//Angela Rubin
//Section C
//aerubin@andrew.cmu.edu
//Project-10-Generative Landscape

function setup() {
    createCanvas(480, 350);
}

function draw() {
    background(73, 112, 137);
    //draw funtions, in order of background to foreground
    sky();
    push();
    stars();
    pop();
    push();
    translate(-180, -170);
    stars();
    pop();
    push();
    translate(-270, -20);
    stars();
    pop();
    push();
    wind();
    pop();
    push();
    translate(-300, 100);
    wind();
    pop();
    push();
    translate(-600, -100);
    wind();
    pop();
    push();
    translate(-900, 50);
    wind();
    pop();
    push();
    translate(-1200, -50);
    wind();
    pop();
    push();
    translate(-1500, 0);
    wind();
    pop();
    push();
    translate(-1800, 100);
    wind();
    pop();
    push();
    translate(-2100, -160);
    wind();
    pop();
    push();
    translate(-2500, -100);
    wind();
    pop();
    push();
    translate(-2900, 50);
    wind();
    pop();
    push();
    translate(-3200, -50);
    wind();
    pop();
    push();
    translate(-3500, 0);
    wind();
    pop();
    push();
    translate(-3900, 100);
    wind();
    pop();
    landscape();
    tree();
    
}
    //draws the tree in the foreground
function tree() {
    stroke(29, 47, 41);
    strokeWeight(2);
    fill(40, 32, 28);
    triangle(100, 200, 95, height, 105, height);
    triangle(100+5, 200-20, 95-6, height, 105-6, height);
    triangle(100-2, 200-40, 95+5, height, 105+5, height);
    triangle(100-7, 200+30, 95-3, height, 105-3, height);
    triangle(100+9, 200-10, 95+2, height, 105+2, height);
    triangle(100+3, 200-100, 95+4, height, 105+4, height);
    triangle(100-2, 200-80, 95-2, height, 105-2, height);
    triangle(100-2, 200-140, 95+6, height, 105+6, height);
    triangle(100+5, 200-120, 95-4, height, 105-4, height);
    triangle(100+22, 200+10, 95+15, height, 105+15, height);
    triangle(100+20, 200+30, 95+20, height, 105+20, height);
    triangle(100+14, 200, 95+14, height, 105+14, height);
    triangle(100-17, 200-30, 95, height, 105, height);
    triangle(100+18, 200+60, 95+20, height, 105+20, height);
}
    //draws the landscape of ellipses
function landscape() {
    noStroke();
    push();
    fill(28, 27, 29);
    rotate(radians(-20));
    ellipse(300+30, 310+50, 130, 50);
    pop();
    for(var b = 0; b < 10; b++) {
        fill(45, 58-b*7, 115-b*9);
        ellipse(10+b*60, 320-b*4, 100, 100+b*6);
    }

}

    //draws the dotted lines of the sky
function sky() {
    strokeWeight(6);
    for(var n = 0; n < 20; n++) {
        for(var i = 0; i < 40;i++) {
            stroke(178, 238, 237);
            line(0+(i*20), 3+(n*15), 10+(i*20), 0+(n*15));
        }
    }
    for(var n = 0; n < 20; n++) {
        for(var i = 0; i < 40;i++) {
            stroke(128, 194, 236);
            line(7+(i*20), 4+(n*15), 17+(i*20), 6+(n*15));
        }
    }
    for(var n = 0; n < 20; n++) {
        for(var i = 0; i < 40;i++) {
            stroke(118, 161, 169);
            line(4+(i*20), 2+(n*15), 14+(i*20), 2+(n*15));
        }
    }
    for(var n = 0; n < 18; n++) {
        for(var i = 0; i < 40;i++) {
            stroke(146, 169, 217);
            line(8+(i*20), 7+(n*15), 18+(i*20), 7+(n*15));
        }
    }
    for(var n = 0; n < 20; n++) {
        for(var i = 0; i < 40;i++) {
            stroke(103, 138, 167);
            line(0+(i*20), 10+(n*15), 10+(i*20), 10+(n*15));
        }
    }
    for(var n = 0; n < 15; n++) {
        for(var i = 0; i < 40; i++) {
            stroke(44, 67, 142);
            line(5+(i*20), 7.5+(n*15), 15+(i*20), 8+(n*15));
        }
    }
    
    for(var n = 0; n < 17; n++) {
        for(var i = 0; i < 40;i++) {
            stroke(54, 80, 164);
            line(10+(i*20), 3+(n*15), 20+(i*20), 2+(n*15));
        }
    }

    for(var n = 0; n < 10; n++) {
        for(var i = 0; i < 40; i++) {
            stroke(37, 48, 84);
            line((i*20), 4+(n*15), 10+(i*20), (n*15));
        }
    }
    for(var n = 0; n < 10; n++) {
        for(var i = 0; i < 40; i++) {
            stroke(46, 60, 121);
            line(4+(i*15), 2+(n*15), 14+(i*15), 4+(n*15));
        }
    }
    for(var n = 0; n < 5; n++) {
        for(var i = 0; i < 40; i++) {
            stroke(2, 38, 95);
            line(3+(i*15), 15+(n*15), 13+(i*15), 10+(n*15));
        }
    }
    strokeWeight(3);
    for(var n = 0; n < 20; n++) {
        for(var i = 0; i < 40; i++) {
            stroke(73, 112, 137);
            line(7+(i*15), 10+(n*10), 16+(i*15), 12+(n*10));
        }
    }

    //sun
    push();
    translate(400, 57)
    for(var i = 0; i < 30; i++) {
        stroke(199, 198, 129);
        rotate(.5);
            for(var n = 0; n < 4; n++) {
                line(25+(i*.1), 0+(n*10), 30+(i*.1), 0+(n*10));
        }
    }
    pop();

    noStroke();
    fill(180, 157, 61);
    arc(400, 55, 50, 50, HALF_PI, PI+HALF_PI);
}

    //draws the moving wind
function wind() {
    translate(millis()/70, 0); //rate at which wind moves
    strokeWeight(4);
    for(var n = 0; n < 5; n++) {
        for(var i = 0; i < 10; i++) {
            stroke(255);
            line(10+(i*20), 200-100+(n*10)+i, 20+(i*20), 200-100+(n*10)+i);
        }
    }
    for(var n = 0; n < 5; n++) {
        for(var i = 0; i < 10; i++) {
            stroke(105, 154, 201);
            line(7+(i*20), 203-100+(n*10)+i, 17+(i*20), 203-100+(n*10)+i);
        }
    }
    for(var n = 0; n < 5; n++) {
        for(var i = 0; i < 10; i++) {
            stroke(146, 171, 238);
            line(15+(i*20), 206-100+(n*10)+i, 25+(i*20), 206-100+(n*10)+i);
        }
    }
    for(var n = 0; n < 5; n++) {
        for(var i = 0; i < 10; i++) {
            stroke(29, 66, 124);
            line(20+(i*20), 200-100+(n*12)+i, 30+(i*20), 200-100+(n*12)+i);
        }
    }

    //upper spiral
    push();
    translate(220, 190);
    for(var i = 0; i < 12; i++) {
        stroke(255);
        rotate(-.25);
            for(var n = 0; n < 5; n++) {
                line(20+(i*.3), 30+(n*12), 30+(i*.3), 30+(n*12));
        }
    }
    pop();

    push();
    translate(220, 190);
    for(var i = 0; i < 12; i++) {
        stroke(105, 154, 201);
        rotate(-.25);
            for(var n = 0; n < 5; n++) {
                line(16+(i*.3), 33+(n*12), 26+(i*.3), 33+(n*12));
        }
    }
    pop();

    push();
    translate(220, 190);
    for(var i = 0; i < 12; i++) {
        stroke(146, 171, 238)
        rotate(-.25);
            for(var n = 0; n < 5; n++) {
                line(22+(i*.3), 25+(n*12), 32+(i*.3), 25+(n*12));
        }
    }
    pop();

    push();
    translate(220, 190);
    for(var i = 0; i < 12; i++) {
        stroke(29, 66, 124);
        rotate(-.25);
            for(var n = 0; n < 5; n++) {
                line(24+(i*.3), 32+(n*12), 34+(i*.3), 32+(n*12));
        }
    }
    pop();




    //lower spiral
    push();
    translate(280, 220);
    for(var i = 0; i < 13; i++) {
        stroke(255);
        rotate(.25);
            for(var n = 0; n < 5; n++) {
                line(20+(i*.4), 30+(n*12), 30+(i*.4), 30+(n*12));
        }
    }
    pop();

    push();
    translate(280, 220);
    for(var i = 0; i < 13; i++) {
        stroke(105, 154, 201);
        rotate(.25);
            for(var n = 0; n < 5; n++) {
                line(23+(i*.4), 33+(n*12), 33+(i*.4), 33+(n*12));
        }
    }
    pop();

    push();
    translate(280, 220);
    for(var i = 0; i < 12; i++) {
        stroke(146, 171, 238);
        rotate(.25);
            for(var n = 0; n < 5; n++) {
                line(16+(i*.4), 27+(n*12), 26+(i*.4), 27+(n*12));
        }
    }
    pop();

    push();
    translate(280, 220);
    for(var i = 0; i < 13; i++) {
        stroke(29, 66, 124);
        rotate(.25);
            for(var n = 0; n < 5; n++) {
                line(25+(i*.4), 23+(n*12), 35+(i*.4), 23+(n*12));
        }
    }
    pop();

}

    //draws the starts in the background
function stars() {
    translate(350, 220);
    push();
    for(var i = 0; i < 30; i++) {
        stroke(255);
        rotate(.25);
            for(var n = 0; n < 4; n++) {
                line(25+(i*.1), 0+(n*10), 30+(i*.1), 0+(n*10));
        }
    }
    pop(); 
    //draws the center of stars (yellow) 
    noStroke();
    fill(250, 226, 140);
    ellipse(0, 0, 40, 40);
}

aerubin-LookingOutwards-10-Section-C

One of Claudia Hart’s many Installations featuring “The Dolls House”

Claudia Hart is a computational fine artist that turns photographs into digital moving art. Originally from New York, New York, she attended school at New York University earning a BA in art history in 1978. She then studied architecture at the Columbia University Graduate School of Architecture and earned her MS is 1984. After exhibiting with the Pat Hearn Gallery, she received an NEA Fellowship in 1989 and moved her practice to Europe where she spent ten years and received many awards and fellowships such as the Kunstfond Bonn, the Stiftung Luftbruekendank Grant, and the Arts International Foundation Grant.

One of her many projects that I found notable portrayed one of her major themes: the blend of technology and nature. The piece is titled “Noh-timeGarden” and it is the third in a series of instillations. These works feature two side by side screens that portray nature in the form of animation. In this particular piece, she portrays a garden from two different points of views that are moving towards one another. Utilizing algorithms and a computer, she is able to digitize nature realistically enough that it appears three dimensional, although it still has the smoothness and perfection of being computationally rendered – seen in the smooth ground and perfectly green pointed leaves. I really admire her ability to make a social statement of nature and technology through her art.

More about “The Doll House”

More about Claudia Hart

looking-outward 10 Thomas Wrabetz

The Breathing Column is an architecture prototype by Caitlin Morris. It is a large installation that reacts to nearby people by turning, expanding and contracting in a lifelike fashion. The prototype is from 2010- I was not able to find a video of the finished installation. In any case, it is an interesting combination of architecture and computing that challenges the perception of buildings as static.

ablackbu-Project-10-Generative Landscape

sketch

var terrainSpeed = 0.0008;
var terrainDetail = 0.008;
var fiX = 450;
var fi2X = 500;
var fi3X = 475;
var scooba;
var scoobaX = 450


function preload() {
    scooba = loadImage('https://i.imgur.com/8HhJZHY.png')
}

function setup() {
    createCanvas(400, 200);

}
 
function draw() {
    background(70,200,250);
    //draw terrain
    terrain();
    //draw sub
    sub();
    //draw fish
    fish();
    //sand
    fill(226,226,176)
    rect(0,height-20,width,20)
    //scooba diver
    scoobaD();
    



}

function terrain() {
    noFill(); 
    beginShape(); 
    stroke(40,120,40)
    strokeWeight(2)
    for (var x = 0; x < width; x++) {
        var t = (x * terrainDetail) + (millis() * terrainSpeed);
        var y = map(noise(t), 0,1, 0, height);
        vertex(x, y); 
        
        

        //terrain
        push();
        fill(40,120,40);
        ellipse(x,y+25,20,20); //thick black hill
        ellipse(x,y+55,10,10); //thin black hill

        stroke(20,80,18);
        strokeWeight(1);
        if(x%2){
            line(x,y,x,y+200) //white lines
        }
        pop();

        
    }
    endShape();
}


function sub() {
        //sub
    push();
    rotate(random(-.01,.01));
    strokeWeight(0);
    fill('yellow');
    
    rect(170,100,70,35,15); //body
    rect(185,89,30,30,5); //top
    rect(150,107,15,20,3); //tail
    rect(162,112,10,10); //connector
    rect(190,85,5,10); //airtube
    ellipse(225,117.5,43,35); //nose


    fill(200);
    //windows
    ellipse(188,115,12,12);
    ellipse(205,115,12,12);
    ellipse(223,115,12,12);

    fill(100);
    //inside windows
    ellipse(188,115,9,9);
    ellipse(205,115,9,9);
    ellipse(223,115,9,9);
    pop();
}

function fish() {

    var fiS = 3.5;
    var fi2S = 2;
    var fi3S = 3;

    strokeWeight(0);
    fill(0);
    //fish1
    ellipse(fiX,50,25,10);
    triangle(fiX+10,50,fiX+16,45,fiX+16,55);
    fiX = fiX-fiS;
    if(fiX < 0){
        fiX = 450;
    }
    //fish2
    ellipse(fi2X,60,25,10);
    triangle(fi2X+10,60,fi2X+16,55,fi2X+16,65);
    fi2X = fi2X-fi2S;
    if(fi2X < 0){
        fi2X = 500;
    }
    //fish3
    ellipse(fi3X,70,25,10);
    triangle(fi3X+10,70,fi3X+16,65,fi3X+16,75);
    fi3X = fi3X-fi3S;
    if(fi3X < 0){
        fi3X = 475;
    }
}  

function scoobaD(){
    var scoobaS = 3.5;
    push();
    scale(.6);
    translate(50,10);
    image(scooba,scoobaX,0);
    //move scooba across screen
    scoobaX = scoobaX - scoobaS;
    if(scoobaX < -150){
        scoobaX = 550;
    }
    pop();
} 
    

For this project I wanted to play off of the Beatles’ song “Yellow Submarine.” I used some code from the example to generate the landscape which I then manipulated to create details in the underwater mountains. The sub in the middle is rotating a tenth of a degree every frame to create a turbulent look. fish and a scuba diver go past at randomly generated speeds.

What I learned while doing this project is that making separate functions for each part and then calling them in the draw function is a great way to change code and manipulate it.

project-10-generativeLandscape

For this project, the first thing that came to mind for a landscape was a sky with a sun, grass and people. It was a fairly simple and straight forward idea. To embellish it, I added some clouds and mushrooms. I used simple shapes to create the various objects: people, mushrooms, clouds.

I made slight differences in the height and y placement of the people, mushrooms and ground to create more depth and also layered the light clouds and dark clouds with the sun to add more depth. There are some randomized variables such as the colors of the dresses, and various sizes of things.

sketch

//array for each set of objects
var people = [];
var mushrooms = [];
var dclouds = [];
var lclouds = [];

function setup() {
  createCanvas(480, 300);
  frameRate(5); //slow down frame rate
  for(var i = 0; i < 5; i++){ //fills array with 5 people
    people.push(makePerson());
  }
  for(var j = 0; j < 7; j++){ //fills array with 7 mushrooms
    mushrooms.push(makeMushroom());
  }
  for(var k = 0; k < 3; k++){ //fills array with 3 dark clouds
    dclouds.push(makeDarkCloud());
  }
  for(var q = 0; q < 3; q++){ //fills array with 3 light clouds
    lclouds.push(makeLightCloud());
  }
}

function draw () {
  background(203, 238, 243);
  noStroke();
  fill(133, 183, 157);
  rect(0, 200, width, 100); //ground
  for(var k = 0; k < dclouds.length; k++){ //access dark clouds array
    dclouds[k].draw(); //draws dark clouds
    dclouds[k].move(); //moves dark clouds
  }
  fill(249, 220, 92);
  ellipse(400, -40, width/2, width/2); //sun
  for(var q = 0; q < lclouds.length; q++){ //access light clouds array
    lclouds[q].draw(); //draws light clouds
    lclouds[q].move(); //moves light clouds
  }
  for(var j = 0; j < mushrooms.length; j++){ //access mushrooms array
    mushrooms[j].draw(); //draws mushrooms
    mushrooms[j].move(); //moves mushrooms
  }
  for(var i = 0; i < people.length; i++){ //access people array
    people[i].draw(); //draws people
    people[i].move(); //moves people
  } 
}

function makePerson() { //creates people
  var person = {px: random(0, 480),       //person x position
                py: 205,                  //person y position
                pheight: random(20, 50),  //person height
                pcolor: random(0, 255),   //person color
                pspeed: -10               //person speed
                }
  person.draw = drawPerson; //sets draw function
  person.move = movePerson; //sets move function
  return person; 
}

function makeLightCloud() { //creates light clouds
  var lcloud = {lx: random(0, 480),       //light clouds x position
                ly: 70,                   //light clouds y position
                lspeed: -1,               //light clouds speed
                lwidth: random(140, 180)  //light clouds width
                }
  lcloud.draw = drawLightCloud; //sets draw function
  lcloud.move = moveLightCloud; //sets move function
  return lcloud;
}

function makeDarkCloud() { //creates dark clouds
  var dcloud = {dx: random(0, 480),       //dark clouds x position
               dy: 50,                    //dark clouds y position
               dspeed: -2,                //dark clouds speed
               dwidth: random(140, 180)   //dark clouds width
               }
  dcloud.draw = drawDarkCloud; //sets draw function
  dcloud.move = moveDarkCloud; //sets move function
  return dcloud;
}

function makeMushroom() { //creates mushrooms
  var mushroom = {mx: random(0, 480),     //mushroom x position
                  my: 200,                //mushroom y position
                  mheight: random(5, 20), //mushroom height
                  mspeed: -3,             //mushroom speed
                  mwidth: random(20, 40)  //mushroom width
                  }
  mushroom.draw = drawMushroom; //sets draw function
  mushroom.move = moveMushroom; //sets move function
  return mushroom;
}

function drawPerson() { //draws people
  fill(this.pcolor);
  triangle(this.px - 10, this.py, this.px + 10, this.py, this.px, this.py - this.pheight); //body
  fill(245, 228, 215);
  ellipse(this.px, this.py - this.pheight, this.pheight - 10, this.pheight - 10); //head
}

function drawMushroom() { //draws mushrooms
  fill(255);
  rect(this.mx - 5, this.my - this.mheight - 10, 10, this.mheight + 10, 5); //stem
  fill(237, 187, 187);
  arc(this.mx, this.my - this.mheight, this.mwidth, 20, PI, 0, PIE); //head
}

function drawDarkCloud() { //draws dark clouds
  fill(184, 215, 219);
  ellipse(this.dx, this.dy, this.dwidth, 50); //cloud
}

function drawLightCloud() { //draws light clouds
  fill(212, 247, 252);
  ellipse(this.lx, this.ly, this.lwidth, 50); //cloud
}

function movePerson() { //moves people
  this.px += this.pspeed; //x position decreasing
  if(this.px < 0){ //pops up on right edge of canvas once off left edge
    this.px = width;
  }
}

function moveMushroom() { //moves mushrooms
  this.mx += this.mspeed; //x position deacreasing
  if(this.mx < 0){ //pops up on right edge of canvas once off left edge
    this.mx = width;
  }
}

function moveDarkCloud() { //moves dark clouds
  this.dx += this.dspeed; //x position decreasing
  if(this.dx < 0 - this.dwidth/2){ //starts appearing on right edge once completely off left edge
    this.dx = width + this.dwidth/2;
  }
}

function moveLightCloud() { //moves light clouds
  this.lx += this.lspeed; //x position decreasing
  if(this.lx < 0 - this.lwidth/2){ //starts appearing on right edge once completely off left edge
    this.lx = width + this.lwidth/2;
  }
}

karinac-LookingOutwards-10

The Carnegie Museum of Natural History has a door which opens up to the section of mystery.  Each time a person opens that door, an animal is seemingly holographically displayed in a room, along with its species name and the sound it produces.

A woman named Caroline Record was at the forefront of this project. The creation of the section of mystery encompassed four different phases: design, media collection, creating software, and fabrication.  The design phase consisted of simply designing a space as well as incorporated a glass that created the holographic effect. After, Record and her team collected images of 30 different species using a 3-D scanner, in which she was able to use to reproduce models of the animals featured in the exhibit. Then, Record designed her own software that allowed the computer to sense when the doors open and closed, switching out the animals so that each time the door opens, a different animal is shown inside. While coding, Record was able to fix more of the lighting and sound problems to generate an even more realistic effect of the animal displayed.  I am interested in the design process behind the section of mystery since I actually had the opportunity to see it just about a week ago.

ashleyc1-Section C-Project-10-Landscape

sketch

//Ashley Chan
//Section C
//ashleyc1@andrew.cmu.edu
//Project-10-Landscape

var flowers = [];

var boatX = 440;
var boatY = 280;
var floatHeight;


function setup() {
    createCanvas(480, 480);
    frameRate(10);

    // create an initial collection of buildings
    for (var i = 0; i < 10; i++){

        var rx = random(width);
        var ry = random(height);

        flowers[i] = makeFlower(rx, ry);
    }

    frameRate(10);

}
 
function draw() {
    background(252, 220, 255);

    drawMountains();
    drawWater();
    drawBoat();

    
    displayHorizon();

    updateAndDisplayFlowers();
    removeFlowersThatHaveSlippedOutOfView();
    addNewFlowersWithSomeRandomProbability(); 

    
}

function updateAndDisplayFlowers(){
    // Update the flower's positions, and display them.
    for (var i = 0; i < flowers.length; i++){

        flowers[i].move();
        flowers[i].display();
    }
}

function removeFlowersThatHaveSlippedOutOfView(){

    var flowersToKeep = [];
    
    for (var i = 0; i < flowers.length; i++){

        if (flowers[i].x + flowers[i].stemThickness > 0) {

            flowersToKeep.push(flowers[i]);
        
        }
    }

    flowers = flowersToKeep; // remember the surviving flowers
}


function addNewFlowersWithSomeRandomProbability() {

    // With a very tiny probability, add a new flower to the end.
    var newFlowerLikelihood = 0.01; 

    if (random(0,1) < newFlowerLikelihood) {

        flowers.push(makeFlower(width));
    }
}


// method to update position of flower every frame
function flowerMove() {
    this.x += this.speed;
    this.y += this.speed;

}
    

// draw the flower and some windows
function flowerDisplay() {

    var floorHeight = -5;
    var stemHeight = this.nFloors * floorHeight; 

    push();
    translate(this.x, height - this.offset);
    
    //draw stems
       fill(210);
       rect(0, 0, this.stemThickness, stemHeight);

       translate(this.stemThickness/2, stemHeight);
        //draw flowers here
        for (var i = 0; i < 100; i++) {

            var g = random(0, 100);
            var b = random(0, 100);

            noStroke();
            fill(206, g, b);
            ellipse(0 , 10, 5, 30);
            rotate(PI/5);

            } 

    pop();
}


function makeFlower(birthLocationX, birthLocationY) {
    var flwr = {x: birthLocationX, 
                y: birthLocationY,
                floatHeight: random(10, 100),
                stemThickness: 5,
                speed: -1.0,
                nFloors: round(random(5, 10)),
                offset: random(10, 40), //allows stems to be drawn at various points
                move: flowerMove,
                display: flowerDisplay}

    return flwr;
}

//horizon that flowers are on
function displayHorizon(){
    noStroke(0);
    fill(81, 64, 137);
    rect(0, height - 100, width, height - 100); 
}


function drawWater() {

    var waterSpeed = 0.00009;
    var waterDetail = 0.0005;

    beginShape(); 

    fill(209, 211, 255);
    noStroke();
   
    for (var xWater = 0; xWater < width; xWater++) {

        var tWater = (xWater * waterDetail) + (millis() * waterSpeed);
        var yWater = map(noise(tWater), 0,1, 180, 280);
        vertex(xWater, yWater); 

        //make it draw to edge of canvas
        vertex(0, height);
        vertex(width, height);

    }

    endShape();

}

function drawMountains() {

    var mountainSpeed = 0.0005;
    var mountainDetail = 0.008;

    //Background Mountains
    beginShape(); 

    fill(101, 101, 202, 150);
    noStroke();
   
    for (var xMount = 0; xMount < width; xMount++) {

        var tMount = (xMount * mountainDetail) + (millis() * mountainSpeed);
        var yMount = map(noise(tMount), 0,1, 20, 100);
        vertex(xMount, yMount); 
        vertex(0, height);
        vertex(width, height);


    }

    //foreground mountains
    endShape();
    beginShape(); 

    fill(204, 204, 255, 150);
    noStroke();
   
    for (var xMount = 0; xMount < width; xMount++) {

        var tMount = (xMount * mountainDetail) + (millis() * mountainSpeed);
        var yMount = map(noise(tMount), 0,1, 80, 180);
        vertex(xMount, yMount); 
        vertex(0, height);
        vertex(width, height);

        //stagger mountain edges
        mountainDetail = .01;
    }

    endShape();

}


function drawBoat() {

    //post and sail
    stroke(255);
    strokeWeight(2);
    fill(255);
    line(boatX, boatY, boatX, boatY - 50);
    triangle(boatX, boatY - 50, boatX + 30, boatY -10, boatX, boatY - 5);

    fill(153, 51, 0);
    noStroke();
    arc(boatX, boatY, 80, 50, TWO_PI, PI);

    boatX -= 1;

    //var constrainY = constrain(boatY, 180, 280); 

    //reset boatX so it can repeat when it goes over edge of canvas
    if (boatX < -40) {

        boatX = width;
    }
}

For this project, I wanted to create a mountainscape because I find those peaceful to look at especially when going through the terrible stress of school in general. My image probably could’ve been pushed further but I had a lot of difficulty understanding what characteristics could automatically be defined within an objet and how those elements interacted with one another so just getting my landscape to this point was a success for me.

 


//Ashley Chan
//Section C
//ashleyc1@andrew.cmu.edu
//Project-10-Landscape

var flowers = [];

var boatX = 440;
var boatY = 280;
var floatHeight;


function setup() {
    createCanvas(480, 480);
    frameRate(10);

    // create an initial collection of buildings
    for (var i = 0; i < 10; i++){

        var rx = random(width);
        var ry = random(height);

        flowers[i] = makeFlower(rx, ry);
    }

    frameRate(10);

}
 
function draw() {
    background(252, 220, 255);

    drawMountains();
    drawWater();
    drawBoat();

    
    displayHorizon();

    updateAndDisplayFlowers();
    removeFlowersThatHaveSlippedOutOfView();
    addNewFlowersWithSomeRandomProbability(); 

    
}

function updateAndDisplayFlowers(){
    // Update the flower's positions, and display them.
    for (var i = 0; i < flowers.length; i++){

        flowers[i].move();
        flowers[i].display();
    }
}

function removeFlowersThatHaveSlippedOutOfView(){

    var flowersToKeep = [];
    
    for (var i = 0; i < flowers.length; i++){

        if (flowers[i].x + flowers[i].stemThickness > 0) {

            flowersToKeep.push(flowers[i]);
        
        }
    }

    flowers = flowersToKeep; // remember the surviving flowers
}


function addNewFlowersWithSomeRandomProbability() {

    // With a very tiny probability, add a new flower to the end.
    var newFlowerLikelihood = 0.01; 

    if (random(0,1) < newFlowerLikelihood) {

        flowers.push(makeFlower(width));
    }
}


// method to update position of flower every frame
function flowerMove() {
    this.x += this.speed;
    this.y += this.speed;

}
    

// draw the flower and some windows
function flowerDisplay() {

    var floorHeight = -5;
    var stemHeight = this.nFloors * floorHeight; 

    push();
    translate(this.x, height - this.offset);
    
    //draw stems
       fill(210);
       rect(0, 0, this.stemThickness, stemHeight);

       translate(this.stemThickness/2, stemHeight);
        //draw flowers here
        for (var i = 0; i < 100; i++) {

            var g = random(0, 100);
            var b = random(0, 100);

            noStroke();
            fill(206, g, b);
            ellipse(0 , 10, 5, 30);
            rotate(PI/5);

            } 

    pop();
}


function makeFlower(birthLocationX, birthLocationY) {
    var flwr = {x: birthLocationX, 
                y: birthLocationY,
                floatHeight: random(10, 100),
                stemThickness: 5,
                speed: -1.0,
                nFloors: round(random(5, 10)),
                offset: random(10, 40), //allows stems to be drawn at various points
                move: flowerMove,
                display: flowerDisplay}

    return flwr;
}

//horizon that flowers are on
function displayHorizon(){
    noStroke(0);
    fill(81, 64, 137);
    rect(0, height - 100, width, height - 100); 
}


function drawWater() {

    var waterSpeed = 0.00009;
    var waterDetail = 0.0005;

    beginShape(); 

    fill(209, 211, 255);
    noStroke();
   
    for (var xWater = 0; xWater < width; xWater++) {

        var tWater = (xWater * waterDetail) + (millis() * waterSpeed);
        var yWater = map(noise(tWater), 0,1, 180, 280);
        vertex(xWater, yWater); 

        //make it draw to edge of canvas
        vertex(0, height);
        vertex(width, height);

    }

    endShape();

}

function drawMountains() {

    var mountainSpeed = 0.0005;
    var mountainDetail = 0.008;

    //Background Mountains
    beginShape(); 

    fill(101, 101, 202, 150);
    noStroke();
   
    for (var xMount = 0; xMount < width; xMount++) {

        var tMount = (xMount * mountainDetail) + (millis() * mountainSpeed);
        var yMount = map(noise(tMount), 0,1, 20, 100);
        vertex(xMount, yMount); 
        vertex(0, height);
        vertex(width, height);


    }

    //foreground mountains
    endShape();
    beginShape(); 

    fill(204, 204, 255, 150);
    noStroke();
   
    for (var xMount = 0; xMount < width; xMount++) {

        var tMount = (xMount * mountainDetail) + (millis() * mountainSpeed);
        var yMount = map(noise(tMount), 0,1, 80, 180);
        vertex(xMount, yMount); 
        vertex(0, height);
        vertex(width, height);

        //stagger mountain edges
        mountainDetail = .01;
    }

    endShape();

}


function drawBoat() {

    //post and sail
    stroke(255);
    strokeWeight(2);
    fill(255);
    line(boatX, boatY, boatX, boatY - 50);
    triangle(boatX, boatY - 50, boatX + 30, boatY -10, boatX, boatY - 5);

    fill(153, 51, 0);
    noStroke();
    arc(boatX, boatY, 80, 50, TWO_PI, PI);

    boatX -= 1;

    //var constrainY = constrain(boatY, 180, 280); 

    //reset boatX so it can repeat when it goes over edge of canvas
    if (boatX < -40) {

        boatX = width;
    }
}

 

ikrsek-SectionC-Project-10-“When Pigs Fly”

“When Pigs Fly”

sketch

//Isadora Krsek
//Ikrsek@andrew.cmu.edu
//Section C
//Project 10: Landscape
//"When Pigs Fly"

var morningStars = [];
var terrainZoom = 0.0099;
var waterZoom = 0.0005;
var terrainSpeed = 0.0004;
var mistZoom = 0.004;

var pigsThatFly = []; // An array to store the images
var pigX;  // The last X location of the character
var pigY;  // The last Y location of the character
var targetX;     // The X goal, from the user's click
var targetY;     // The Y goal, from the user's click
var track = (0); //to keep track fo index in array "pigsThatFly"
var theX; //the current x location of character
var theY; //the current y location of character
 

function preload(){
    // These URLs are for the individual walk cycle images,
    // stored in the imgur album http://imgur.com/a/85DTu
    var filenames = [];
    filenames[0] = "https://i.imgur.com/yHI2wXX.png";
    filenames[1] = "https://i.imgur.com/yHI2wXX.png"
    filenames[2] = "https://i.imgur.com/Z5T1eCI.png";
    filenames[3] = "https://i.imgur.com/xPr6ucE.png";
    filenames[4] = "https://i.imgur.com/knjfg9E.png";
    filenames[5] = "https://i.imgur.com/uh2mgbF.png";
    filenames[6] = "https://i.imgur.com/k76ZBzT.png";
    filenames[7] = "https://i.imgur.com/nfG9mkZ.png";
    filenames[8] = "https://i.imgur.com/UXGbXhS.png";
    filenames[9] = "https://i.imgur.com/UXGbXhS.png";
    filenames[10] = "https://i.imgur.com/yHI2wXX.png";
    
    // PUT CODE HERE TO LOAD THE IMAGES INTO THE frames ARRAY,
    for(var z=0; z < filenames.length; z++) {
    pigsThatFly.push(loadImage(filenames[z]));
    }
}

function setup() {
    createCanvas(640, 240);
    imageMode(CENTER);
    frameRate(35);//natural rate 
  
    // Initialize the character and target positions. 
    pigX = width / 2; 
    pigY = height / 2; 
    targetX = pigX;
    targetY = pigY;
   
    //# which allows for new star to appear
    StarProb = 20; 

  //morningStars inital amount 
    for (var i = 0; i < 22; i++) {
      morningStars[i] = new Star(random(width));
    }  
}


function draw() {
    background(255);
    noStroke();
    
    gradientBack();
    drawStars();
    drawMount();
    drawWater();
    drawPig();
}


function drawStars(){
        //when random # is smaller than probability then new start occurs  
  if (StarProb > random(0,100)) {
    morningStars.push(new Star(width));
  }

  for (var i = 0; i < morningStars.length; i++) {
    morningStars[i].move(); //update star array
    morningStars[i].display(); 

    if (morningStars[i].x < 0) { //if star goes out of boundary, remove it
      morningStars.splice(i, 1);
    }    
  }
}

function drawMount(){
    //first mountain
    push();
    fill(0, 180);
    beginShape(); 
    noStroke();
    for (var x = 0; x < width; x++) {
        var t = (x * terrainZoom) + (millis() * terrainSpeed);
        var y = map(noise(t), 0,1, height/2, height*3/4);
        vertex(x, y); 
    }
    vertex(width, height);
    vertex(0,height);
    endShape();
    pop();
}

function drawWater(){
  //water
    //water main
    push();
    fill(173,216,255,100); 

    beginShape(); 
    noStroke();
    for (var x = 0; x < width; x++) {
        var t = (x * waterZoom) + (millis() * terrainSpeed);
        var y = map(noise(t), 0,1, height/2, height*3/4);
        vertex(x+.2, y+70); 
    }
    vertex(width, height);
    vertex(0,height);
    endShape();
    pop();
    //water layers
    fill(173,216,255,115); 
    beginShape(); 
    for (var a = 0;  a < width; a++) {
        var b = (a * waterZoom) + (millis() * terrainSpeed);
        var c = map(noise(b), 0,1, height/2, height*3/4);
        vertex(a+.2, c+75); 
    }
    vertex(width, height);
    vertex(0,height);
    endShape();
    pop();
        beginShape(); 
    for (var d = 0;  d < width; d++) {
        var e = (d * waterZoom) + (millis() * terrainSpeed);
        var f = map(noise(e), 0,1, height/2, height*3/4);
        vertex(d+.2, f+80); 
    }
    vertex(width, height);
    vertex(0,height);
    endShape();
    pop();
    
    
    

}

function drawPig(){
      // PUT CODE HERE TO MOVE THE CHARACTER TOWARDS THE TARGET
    var dx = targetX - pigX;
    var dy = targetY - pigY;
    var distanceFromCharacterToTarget = sqrt(dx*dx + dy*dy);
    //control how character moves toward target 
    theX = lerp(pigX,targetX,.15);
    theY = lerp(pigY,targetY,.15);
    //keep looping through the images continuously/seamlessly 
    if (track >= pigsThatFly.length){
      track = 0; 
    }
    
    // PUT CODE HERE TO DISPLAY THE CHARACTER, CYCLING THROUGH THE FRAMES.
    // WHEN YOU GET THAT WORKING, FLIP THE IMAGE IF THE CHARACTER'S HEADING LEFT. 
   //if the current x location is smaller than the last x location, it will be walking left 
    if (theX < pigX){
      push();
      scale(-1,1);//flip image 
      image(pigsThatFly[track],theX*-1,theY); //you multiply the X-coordinate by -1 so it walks in the right direction 
      pop();
    }
    //otherwise if it's larger, it will be walking right
    else if (theX >= pigX){
      push();
      image(pigsThatFly[track],theX,theY);
      pop();
    }
    
    //re-fresh values of pigX & pigY (which keep track of last place of character)
    pigX = theX;
    pigY = theY;
    
    //cycle through the walking images 
    track = track + 1
    
    
}

function gradientBack(){
  //Create gradient color for the background
    topGrad = color(117, 118, 195); //top gradient 
    bottomGrad = color(250, 207, 194); //bottom gradient 

    //gradient color steps
    var gradientSteps = (height);
    var gradientSteps2 = (30);

    for (var i = 0; i <= gradientSteps; i++) { //for each gradient strip
      fill(lerpColor(topGrad, bottomGrad, i/height)); //fill color inerpolation
      rect(0, (i/height * height) - (1/height * height), width, 1/height * height); //use the color draw boxes
    }
    
    //other gradient 
    /*
    for (var q = 0; q <= gradientSteps2; q++) { //for each gradient strip
      var sizeHeight = ((1/height * height)/2);
      noStroke();
      fill(lerpColor(topGrad2, bottomGrad2, q/gradientSteps2),80); //fill color inerpolation
      rect(0, (q/height * height) - sizeHeight +195, width, sizeHeight); //use the color draw boxes
      
      fill(lerpColor(topGrad3, topGrad2, q/gradientSteps2),80);
      rect(0, (q/height * height) - sizeHeight+164, width, sizeHeight);
    }  
    */
}

function mousePressed() {
    targetX = mouseX;
    targetY = mouseY;
}

//generate morningStars
function Star(xLocation){
  var randoOpa = random(80,180); //have the brightness of stars vary 
  var randoSize = random(.5,2); //have star size vary 
  
  this.x = xLocation;//controlled above by random width 
  this.y = random(1, 180); //range for stars to appear
  this.speed = (-1.5); //speed       

  this.move = function() {
  	  this.x += this.speed; //move the stars
  }

  this.display = function() {
	//draw the stars here 
	  fill(255,255,255,randoOpa);
	  ellipse(this.x, this.y,randoSize,randoSize);
  }
}






This time around I wanted to do something a little more fun than usual. I had some trouble deciding on what I wanted to do, but eventually decided to just do a pig flying across the water in the early early morning (early enough when you can still see stars). The reason why is because I was inspired by the phrase “when pigs fly”, but not in the traditional sense of the phrase. I was more interested in where pigs would go and what they would do when they fly – why would pigs fly? So I ended up deciding a pig would take the time to go on an early morning flight, beneath the glow of the stars at dawn.
I wanted to do something humorous and beautiful and this is the result.

Also, fun fact:
If you click on the screen, the pig will move to your mouse location.

Here is a picture of the original sketch.

karinac-Project 10

karinac-project10

//Karina Chiu
//Section C
//karinac@andrew.cmu.edu
//Project 10

var fish1;
var fish2;
var fish1X = 500;
var fish1Y = 150;
var fish2X = -200;
var fish2Y = 100;
var fish3X = 650;
var fish3Y = 200;
var fish4X = 700;
var fish4Y = 60;
var fish5X = 540;
var fish5Y = 40;
var fishWidth = 40;
var fishHeight = 30;

function preload() {
	fish1 = loadImage("https://openclipart.org/image/2400px/svg_to_png/263089/fish-3.png");
	fish2 = loadImage("https://openclipart.org/image/2400px/svg_to_png/263085/1475323265.png");
	fish3 = loadImage("https://openclipart.org/image/2400px/svg_to_png/263089/fish-3.png");
	fish4 = loadImage("https://openclipart.org/image/2400px/svg_to_png/263089/fish-3.png");
	fish5 = loadImage("https://openclipart.org/image/2400px/svg_to_png/263089/fish-3.png");
}

function setup() {
	createCanvas(500,300);
	frameRate(100);
}

function draw(){
	background(18,27,180);
	drawSand();
	drawFish();
}


//drawing sea floor
var terrainSpeed = 0.0005;
var sandFloor = 0.010;

function drawSand() {  
    noStroke();
    fill(170,150,120); 

    beginShape();
        for (x=0; x < width; x++) {
            var t = (x*sandFloor) + (millis()*terrainSpeed);
            var y = map(noise(t), 0, 1, 220, 270);
            vertex(x, y);
            vertex(0,height);
            vertex(width,height);
        }
    endShape();
}

function drawFish() {
	image(fish1, fish1X, fish1Y, fishWidth, fishHeight);
	fish1X -= random(1,2);
	fish1Y -= random(-0.5,0.5);

	if (fish1X < -fishWidth) {
		fish1X = 500;
	}

	image(fish2, fish2X, fish2Y, fishWidth, fishHeight);
	fish2X += random(0,0.5);
	fish2Y += random(-0.5,0.5);

	if (fish2X > 700) {
		fish2X = -100;
	}

	image(fish3, fish3X, fish3Y, fishWidth, fishHeight);
	fish3X -= random(0,2);
	fish3Y -= random(-0.5,0.5);

	if (fish3X < -fishWidth) {
		fish3X = 650;
	}

	image(fish4, fish4X, fish4Y, fishWidth, fishHeight);
	fish4X -= random(1,2.5);
	fish4Y -= random(-1,1);

	if (fish4X < -fishWidth) {
		fish4X = 700;
	}

	image(fish5, fish5X, fish5Y, fishWidth, fishHeight);
	fish5X -= random(1,2.5);
	fish5Y -= random(-1,1);

	if (fish5X < -fishWidth) {
		fish5X = 540;
	}
}

I wanted to create an ocean floor. At first, I was only going to draw the orange fishes going to the left. However, I decided to add more. Drawing the terrain was definitely the most difficult part of the process, but I had learned a lot from it.