let colors=["#1c4d32","#537c59","#2c3a60","#9e523c","#dd995c","#4a3111","#d6c5b6"]
font= loadFont('FamiljenGrotesk-VariableFont_wght.ttf')
simplex= new openSimplexNoise(Date.now())
branch(200,350, 200, 200, 100, -HALF_PI)
function branch(x, y, x2, y2, length, angle){
for(let i=0; i<=1; i+=0.05){
let c1= colorPicker(x, y)
let c2= colorPicker(x2, y2)
let c= color(spectral.mix(c1, c2, i))
let s=lerp(length, length/2, i)
let p1= createVector(x, y)
let p2= createVector(x2, y2)
let p=p5.Vector.lerp(p1, p2, i)
nodes.push(createVector(x2, y2))
let newAngle= angle+ random(angleDivergence, -angleDivergence);
let newPos= createVector(x2+cos(newAngle)*newL, y2+sin(newAngle)*newL)
if(dist(newPos.x, newPos.y, n.x, n.y)<length/4){
branch(x2, y2, newPos.x, newPos.y, length*0.5, newAngle)
function colorPicker(x, y){
let ci= floor(noise(x*10, y*10)*colors.length)
function colorMixer(x,y, a,colorArray) {
let c = noise((x+y)/100, a) * colorArray.length
let c2 = floor(c + 1) % colorArray.length
let color1 = colorArray[c1]
let color2 = colorArray[c2]
let coloring = spectral.mix(color1, color2, mix)