islandd sketch
function setup() {
createCanvas(400, 300);
background("lightsteelblue");
}
function draw() {
strokeWeight(0.5);
numLines = 30;
//sun beams
strt(-width, 0, width, 2*height, 0, 0, width, 0, 20, "yellow");
fill("yellow");
ellipse(width, 0, 100); //sun
//mountains
fill("green");
triangle(90, 150, 20, 250, 390, 250);
triangle(290, 150, 390, 250, 20, 250);
stroke("green");
line(90, 150, 20, 250); //left mountain
line(290, 150, 390, 250); //right mountain
crshtch(90, 150, 20, 250, 290, 150, 390, 250, numLines, "palegreen");
crshtch(290, 150, 390, 250, 90, 150, 20, 250, numLines, "palegreen");
//water
fill("lightseagreen");
rect(0, 250, 400, 50);
lne(0, 250, 0, 300, 400, 250, 400, 300, 30, "blue");
}
//diag crosshatch
function crshtch(x1, y1, x2, y2, x3, y3, x4, y4, numLines, colour){
stroke(colour);
dx3 = (x4-x3)/numLines;
dy3 = (y4-y3)/numLines;
dx1 = (x2-x1)/numLines;
dy1 = (y2-y1)/numLines;
dx2 = (x4-x3)/numLines;
dy2 = (y4-y3)/numLines;
for(var i = 0; i <= numLines; i ++){
line(x1, y1, x4, y4);
x1 += dx1;
y1 += dy1;
x2 += dx2;
y2 += dy2;
x3 += dx3;
y3 += dy3;
}
}
//light lines
function strt(a1, b1, a2, b2, a3, b3, a4, b4, numLines, colour){
stroke(colour);
dx3 = (a4-a3)/numLines;
dy3 = (b4-b3)/numLines;
dx1 = (a2-a1)/numLines;
dy1 = (b2-b1)/numLines;
dx2 = (a4-a3)/numLines;
dy2 = (b4-b3)/numLines;
for(var i = 0; i <= numLines; i ++){
line(a1, b1, a4, b4);
a1 += dx1;
b1 += dy1;
}
}
//straight lines
function lne(x1, y1, x2, y2, x3, y3, x4, y4, numLines, colour){
stroke(colour);
dy1 = (y2-y1)/numLines;
dy3 = (y4-y3)/numLines;
for(var i = 0; i <= numLines; i ++){
line(x1, y1, x3, y3);
y1 += dy1;
y3 += dy2;
}
}