xxxxxxxxxx
71
var boolDoRefresh = true;
var img;
function preload() {
img = loadImage('tx_compass.png');
}
function setup() {
createCanvas(640, 640);
}
function draw() {
//noprotect
if (boolDoRefresh) {
var rectSize = 30;
var offset = 5;
var rand = 0;
background(255);
for (j = 0; j < 40; j++){
for (i = 0; i < 40; i++){
for(k = 3; k > 0; k--){
rand = (random(0 , 1));
if (rand > 0.95){
push();
translate(j * rectSize, i * rectSize);
//trees
stroke(color(random(10, 30), random(50, 250), random(50, 80), 255));
fill(color(random(10, 30), random(50, 250), random(50, 80), 255));
rect(-(k * 2) * (rectSize * 2), -(k / 2) * rectSize,
(k * 0.5) * rectSize, (k * 0.5) * rectSize);
//houses
noStroke();
fill(color(random(140, 170), random(30, 70), random(30, 50), 255));
rect(-(k * 3) * rectSize, -(k * 3) * rectSize,
(k * 0.3) * rectSize, (k) * rectSize/2);
//water
fill(color(random(10, 50), random(180, 230), random(200, 250), 255));
ellipse(-(k / 3) * (rectSize / 2), -(k / 3) * (rectSize / 2),
(k / 3) * (rectSize * 0.7), (k / 3) * (rectSize * 0.7));
//grid boundaries
stroke(color(random(170, 230), random(40, 100), random(20, 50), 255));
strokeWeight(random(1, 5));
noFill();
rect(-(k * rectSize * 2), (i * rectSize * 2),
rectSize * 7, rectSize * 7);
pop();
}else{
//grass
noStroke();
fill(color(random(100, 230), random(170, 200), random(100, 130), 255));
rect(j * rectSize, i * rectSize, rectSize, rectSize + j * rectSize);
}
}
}
}
//texas compass
image(img, 0, 500, img.width * 0.5, img.height * 0.5);
boolDoRefresh = false;
}
}
function mousePressed() {
boolDoRefresh = true;
}