Code Sketch


Dry Branch
By: Kanchan Samant
Category: Art
clear()
setSpeed(slow)
setBackground(white)

def branch(n: Double) {
    forward(n)
}

def tree(n: Double) {
    savePosHe()
    setPenColor(cm.rgb(n.toInt, math.abs(200 - n * 3).toInt, 125))
    if (n <= 25) {
        setPenThickness(0.5)
        branch(n / 2)
    }
    else {
        setPenThickness(n /20)
        branch(n)
        right(30)
        tree(0.6 * n - 2)
        left(35)
        left(18)
        tree(n - 10)
    }
    restorePosHe()
}

hop(-150)
tree(90)