# =========================================================================== # # Taken from: www.contextfreeart.org/gallery/view.php?id=4268 # Included at: 10.02.2022 # =========================================================================== #

CF::Background = [b -0.8 h 280 sat 0.8]

T=16

startshape TREE(T,T)[]

shape TREE(natural n, natural P) {

TRUNK(n+1)[b -1]

if(n < floor(P*0.2))
if(rand()<0.8)
transform[x -2..2 s 6..8 r 0..180]
    LEAF [ b 1 sat 1 a -0.3 h 90..160 ] 

if(n > 0)
{
    TREE(n--1,P) [s 0.95 1 y 1 ]

    if(n<(P*0.75))
    if(rand()< 0.8)
    transform [ r if(rand()<0.5,-90,90)]
        TREE(n,n) [ s 0.5 y 0.5 ]
}

}

shape TRUNK(natural n) {

loop n [ y (1/n)]
transform [ y -0.5]
    STROKE[b 0.8 sat 1 h 20]

}

path LEAF {

L=6
loop i=L []
    ARCTO((i/L)*if(mod(i,2)==0,1,-1),0,(i/L)/2)
STROKE(0.01)[]

}

path STROKE {

MOVETO(-0.5,0)
CURVETO(0.5,0,-0.25,0.25,0.25,-0.25)
STROKE(0.05)[]

}