xxxxxxxxxx
116
var size = 20;
var Size = 30;
var space = 50;
function setup() {
createCanvas(640, 640);
drawGrid();
boolDoRefresh = true;
}
function draw() {
drawTrees();
textSize(25);
textFont("Georgia");
fill(237, 153, 7);
text(" where the mouse travels ", width / 2, size + 5);
textSize(15);
fill(176, 129, 0);
noStroke();
text(" click to change location ", width / 2 + size, size *2);
if (boolDoRefresh) {
background(196, 219, 255);
noStroke();
textSize(13);
textFont("Georgia");
fill(145, 89, 17);
text(concat("LONGITUDE: ", mouseY),10,size);
text(concat("LATITUDE: ", mouseX),10, size * 2);
for (var y = 0; y <= 80; y++) {
for (var x = 0; x < 640; x++) {
// green bushes, hidden treasures
if(random(0,50) > 9){
noStroke();
fill(255, random(255), random(255)); //starburst colors sort of
push();
translate(-30,60);
scale(1.5);
fill(138, 207, 132);
ellipse(x * space + 10, y * space + 10, size, size);// tree top
translate(-5, 10);
scale(0.5);
ellipse(x * space + 10, y * space + 10, 30, size);
translate(-10, 10);
scale(1);
ellipse(x * space + 10, y * space + 10, size, size);
pop();
}else{
noStroke();
ellipse(x * space + 25, y * space + 25, size, size);
}
}
}
boolDoRefresh = false;
}
//mouse trail :")
fill("yellow");
ellipse(mouseX, mouseY, 10, 10);
}
function drawTrees() {
//trees
fill(0);
rect(320, 194, 10, 20); // trunk
fill(107, 247, 96); // tree leaves
noStroke();
ellipse(326, 172, size, size);// tree top
ellipse(324, 192, Size, size);
ellipse(330, 182, size, size);
// tree 2
push();
translate(-30,30);
scale(1.5);
fill(0);
rect(320, 194, 10, 20); // trunk
fill(107, 247, 96); // tree leaves
noStroke();
ellipse(326, 172, size, size);// tree top
ellipse(324, 192, Size, size);
ellipse(330, 182, size, size);
pop();
}
function drawGrid() {
// noprotect
for (var y = 0; y <= 640; y += 15) {
for (var x = 0; x <= 640; x += 15) {
//color gradient needs to be implemented
fill(255, 206, 145);
noStroke();
rect(x, y, 10, 10);
}
}
}
function mousePressed() {
boolDoRefresh = true;
}