let colors=["#f6ac2c","#b7656b","#05729b","#5e899e","#601d24","#8ea400","#03417b"]
let m=min(windowWidth, windowHeight)
simplex= new openSimplexNoise(Date.now())
let river= createGraphics(width, height*0.7)
let bigtree= createGraphics(width*0.15,height*0.5)
let littletree= createGraphics(width*0.1, height*0.4)
diamondPattern(height*0.033, bigtree)
diamondPattern(height*0.033, littletree)
treeCut(width*0.15,height*0.5, bigtree, 1)
treeCut(width*0.15,height*0.5, littletree, 2)
zigzagPattern(river.width/25, river)
riverCut(width, height*0.66, river)
rect(0, 0, width, height/3)
rect(0, height/3, width, height)
for(let y=height*0.33; y<=height; y+=10){
sw=map(y, height*0.33, height, 0.1, 2)
for(let y=0; y<height*0.33; y+=10){
for(let x=0; x<width; x+=10){
star(x+random(-1, 1), y+random(-1, 1), r)
for(let x=random(width*0.1); x<width*0.8; x+=random(width*0.2, width*0.3)){
let bump= random(height*0.05)
image(littletree, x, -bump)
image(bigtree, height*0.265, 0)
image(river, 0, height*0.33)
function treeCut(h, w, canvas, seed){
for(let y=0; y<canvas.height; y++){
let cutIn=canvas.width*0.1
cutIn= map(y, canvas.height*0.8, canvas.height, canvas.width*0.1, 0)
let waver= simplex.noise2D(y/10, seed)*(cutIn*0.1)
canvas.vertex(cutIn+waver, y)
for(let y=0; y<canvas.height; y++){
let cutIn=canvas.width*0.1
cutIn= map(y, canvas.height*0.8, canvas.height, canvas.width*0.1, 0)
let waver= simplex.noise2D(y/10, seed)*(cutIn*0.1)
canvas.vertex(canvas.width-cutIn-waver, y)
canvas.vertex(width, height)
function zigzagPattern(patternHeight, canvas){
canvas.background(colors[0])
let hStep= patternHeight*0.5
for(let y=0; y<canvas.height+patternHeight; y+=patternHeight){
for(let x=0; x<canvas.width+patternHeight; x+=patternHeight){
vertex(x+patternHeight, y-hStep)
for(let x=canvas.width+patternHeight*0.5; x>=0; x-=patternHeight){
for(let y=0; y<canvas.height+patternHeight; y+=patternHeight){
for(let x=0; x<canvas.width+patternHeight; x+=patternHeight){
canvas.ellipse(x, y-patternHeight*0.7125, patternHeight*0.25)
canvas.ellipse(x+hStep, y+patternHeight*0.7125, patternHeight*0.25)
function riverCut(patternWidth, patternHeight, canvas){
canvas.vertex(canvas.width, 0)
let beg= createVector(canvas.width, 0)
let end= createVector(-canvas.height*0.2, canvas.height)
for(i=0; i<canvas.width; i+=0.001){
let basePos=p5.Vector.lerp(beg, end, i)
let xoff= simplex.noise2D(i*2, 1)*(canvas.width*0.1)+ simplex.noise2D(i*20, 1)*canvas.width*0.005
let yoff= simplex.noise2D(i*2, 2)*(canvas.width*0.1)+ simplex.noise2D(i*20, 2)*canvas.width*0.005
canvas.vertex(basePos.x+xoff, basePos.y+yoff)
let rbeg= createVector(canvas.width*1.1, canvas.height*0.2)
let rend= createVector(canvas.height*0.6, canvas.height)
for(i=0; i<canvas.width; i+=0.001){
let basePos=p5.Vector.lerp(rbeg, rend, i)
let xoff= simplex.noise2D(i*2, 1.1)*(canvas.width*0.1)+ simplex.noise2D(i*20, 1)*canvas.width*0.005
let yoff= simplex.noise2D(i*2, 2.1)*(canvas.width*0.1)+simplex.noise2D(i*20, 2)*canvas.width*0.005
canvas.vertex(basePos.x+xoff, basePos.y+yoff)
let xendOff= simplex.noise2D(0, 1.1)*(canvas.width*0.1)
let yendOff= simplex.noise2D(0, 2.1)*(canvas.width*0.1)
let xbegOff= simplex.noise2D(2, 1.1)*(canvas.width*0.1)
let ybegOff=simplex.noise2D(2, 2.1)*(canvas.width*0.1)
canvas.vertex(width+width*0.5, height)
canvas.vertex(rbeg.x+xbegOff, rbeg.y+ybegOff)
function diamondPattern(patternHeight, canvas){
canvas.background(colors[3])
canvas.strokeWeight(patternHeight*0.05)
let hStep= patternHeight*0.5
for(let y=0; y<canvas.height+patternHeight; y+=patternHeight*0.9){
for(let x=0; x<canvas.width+patternHeight; x+=hStep){
canvas.line(x, y, x+pwh, y-pwh)
canvas.line(x, y, x-pwh, y-pwh)
canvas.line(x, y+patternHeight*0.125, x+pwh, y-patternHeight*0.05)
canvas.line(x, y+patternHeight*0.125, x-pwh, y-patternHeight*0.05)
canvas.line(x, y+patternHeight*0.125, x+pwh, y+patternHeight*0.25)
canvas.line(x, y+patternHeight*0.125, x-pwh, y+patternHeight*0.25)
canvas.line(x, y+patternHeight*0.25, x+pwh, y+patternHeight*0.4)
canvas.line(x, y+patternHeight*0.25, x-pwh, y+patternHeight*0.4)
canvas.line(x, y+patternHeight*0.375, x+pwh, y+patternHeight*0.525)
canvas.line(x, y+patternHeight*0.375, x-pwh, y+patternHeight*0.525)
canvas.line(x, y+patternHeight*0.5, x+pwh, y+patternHeight*0.65)
canvas.line(x, y+patternHeight*0.5, x-pwh, y+patternHeight*0.65)
function uShapeCut(r, canvas){
canvas.vertex(paper1.width, 0)
canvas.vertex(paper1.width, paper1.height)
canvas.vertex(0, paper1.height)
for(let a=0; a<=PI; a+=PI/100){
let x= paper1.width*0.5+cos(a)*r
let y=paper1.height*0.5+sin(a)*r
for(let a=PI; a>0; a-=PI/100){
let x= paper1.width*0.5+cos(a)*r
let y=paper1.height*0.5+sin(a)*r
for(let a=TAU; a>=0; a-=TAU/11){
vertex(cos(a)*r, sin(a)*r)
vertex(cos(a-TAU/30)*(r*0.5), sin(a-TAU/30)*(r*0.5))
function starShapeCut(r, canvas){
canvas.vertex(paper1.width, 0)
canvas.vertex(paper1.width, paper1.height)
canvas.vertex(0, paper1.height)
for(let a=TAU; a>=0; a-=TAU/15){
canvas.vertex(canvas.width*0.5+ cos(a)*r, canvas.height*0.5+sin(a)*r)
canvas.vertex(canvas.width*0.5+ cos(a-TAU/30)*(r*0.75), canvas.height*0.5+sin(a-TAU/30)*(r*0.75))