RNAYYAR Generative Landscape

Initially, I wanted to have a Bhutan inspired mountain-scape with Buddhist temples at the peaks. I couldn’t figure out how to establish temples at the peaks without recycling the Planting the Flag code, but I didn’t know how to tweak that function that renders the terrain in the first place so I gave up. Then I changed my idea anyways.

These are some strong and determined birds migrating to warmer climate.  They have a long way to go.

I don’t really like how this appears in-site so I’m attaching an openprocessing.org link that will take you to a full screen version of this:

https://www.openprocessing.org/sketch/388221

I highly recommend looking at the link instead!

 

sketch

/* Rhea Nayyar
rnayyar@andrew.cmu.edu
Section C
Project 10-C; Generative Landscape
*/

var terrainSpeed = 0.0003;
var terrainDetail = 0.0025;

function setup() {
    createCanvas(windowWidth, windowHeight);
    frameRate(10);
}
 
function draw() {
    background(200, 240, 255); //sky
   
 noStroke();
    fill(40, 75, 55, 100);  //rolling mountain tops
    beginShape(); 
    for (var x = 0; x < width; x++) {
        var t = (7*x * terrainDetail) + (millis() * terrainSpeed/2);
        var y = map(noise(t/2), 0,1, 0, height);
        curveVertex(x, y); 
    }
 curveVertex(width, height);
 curveVertex(0,width);
 endShape(CLOSE);



 noStroke(); //cloud front 1 (hits the floor of the canvas)
    fill(255, 245, 250, 90); 
    beginShape(); 
    for (var x = 0; x < width; x++) {
        var t = (4.5*x * terrainDetail) + (millis() * terrainSpeed/2);
        var y = map(noise(t/2), 0,1, 0, height);
        curveVertex(x, y); 
    }
 curveVertex(width, height);
 curveVertex(0,width);
 endShape(CLOSE);


    noStroke(); //cloud front 2 (hits the floor of the canvas)
    fill(250, 240, 250, 180); 
    beginShape(); 
    for (var x = 0; x < width; x++) {
        var t = (2.5*x * terrainDetail) + (millis() * terrainSpeed/2);
        var y = map(noise(t/2), 0,1, 0, height);
        curveVertex(x, y); 
    }
 curveVertex(width, height);
 curveVertex(0,width);
 endShape(CLOSE);


 fill(252, 250, 255, 140) //wispy cloud stream 1
 beginShape();
 for (var x = 0; x < width; x++) {
        var t = (x/2 * terrainDetail) + (millis() * terrainSpeed/2);
        var y = map(noise(t/2), 0,1, 0, height);
        curveVertex(x, y); 
 }
        endShape(CLOSE);

fill(232, 250, 255, 140) //wispy cloud stream 2
 beginShape();
 for (var x = 0; x < width; x+=3) {
        var t = (x * terrainDetail) + (millis() * terrainSpeed/2);
        var y = map(noise(t/2), 0,1, 0, height);
        curveVertex(x, y); 
 }
        endShape(CLOSE);


     for (var x = 0; x < width; x+=12) { //bird line
        var t = (1.5*x * terrainDetail) + (millis() * terrainSpeed/8);
        var y = map(noise(t/2), 0,1, 0, height);
        if(x%7===0){
            
        fill('Red');
        birb(x,y);
     }
    
}
    
   
}

function birb(x, y){
    fill(70);
    ellipse(x, y, 30, 10); //body
    rect(x+5, y-2, 12, 5); //tiny neck
     fill(220, 200, 0);
    triangle(x+21, y-2, x+28, y+2, x+21, y+3); //beak
    fill(70);
    ellipse(x+16, y, 11, 8); //head
    fill('MediumSlateBlue'); //eye
    ellipse(x+17, y-1, 2, 2);
    fill(85); //wing
    quad(x-3, y-3, x+10, y, x+8, y+7, x-10, y+10, 20);


}

Leave a Reply