Project-11-Landscape

I choose to do a picture I took in Pakistan so I created the images in Illustrator and then created variation in the landscape. and ultimately wanted variation of falling bananas and cows in the distance.

Picture I took in Pakistan.
graanak-11
//Graana Khan 
//Section B

var noiseParam = 0;
var noiseStep = 0.05;
var weeds = []; 
var bananaGuy;
var bananas = [];
var cows = [];

function preload(){
	bananaGuy = loadImage("https://i.imgur.com/QlEAbwn.png");
	bananas[0] = "https://i.imgur.com/DGbCivK.png";
	bananas[1] = "https://i.imgur.com/kYS7JBv.png";
	bananas[2] = "https://i.imgur.com/oLWOnSw.png";
	cows[0] = "https://i.imgur.com/DbRWV09.png";
	cows[1] = "https://i.imgur.com/IDXjr5m.png";
	cows[2] = "https://i.imgur.com/rHLRVkb.png";

	for(var i=0; i < bananas.length; i++){
		bananas[i] = loadImage(bananas[i]);
	}

	for(var i=0; i < cows.length; i++){
		cows[i] = loadImage(cows[i]);
	}
}

function setup() {
    createCanvas(480, 300);
    background(220);
    frameRate(10);

    strokeWeight(5);

    //initializing the noise and array
    for(var i=0; i <= 100; i++){
    	var n = noise(noiseParam);
    	var value = map(n, 0, 1, 100, height);
    	weeds.push(value);
    	noiseParam += noiseStep; 
    }

}

function draw() {
	background(232, 208, 156);

//terrain moving in the background
	weeds.shift();
	var n = noise(noiseParam);
	var value = map(n, 0, 1, 100, height);
	weeds.push(value);
	noiseParam += noiseStep; 

	stroke(135, 119, 76);
	fill(135, 119, 76);
	beginShape();
	curveVertex(0, height);
	curveVertex(0, height);
	for(var i=0; i < 100; i++){
		vertex(i*30, weeds[i]);
	}
	vertex(width, height);
	vertex(width, height);
	endShape();
//dirt road
	noStroke();
	fill(96, 78, 41);
	rect(0, 229, 480, 71);

//banana truck 
	image(bananaGuy, 0, 0, 480, 300);

	image(bananas[2], 260, 260);
	scale(0.5);
	image(cows[0], 120, 370);

}

Leave a Reply