Recursive animated tree

I played a long ago with recursive trees. Now I’ve seen an animated one and have written this one in Codea. It works very fast in noSmooth mode.
http://www.youtube.com/watch?v=5vSaRMzyurE

--Move your finger up and down 

function setup()
    size = 200
    zoom=1.2
    noSmooth()
    strokeWidth(1)
    displayMode(FULLSCREEN)
end

function draw()
    background(0, 0, 0, 255)
    angle = (HEIGHT - CurrentTouch.y) / HEIGHT * 90
    translate(WIDTH/2,0)
    line(0,0,0,size*zoom)    -- draw trunk
    translate(0,size*zoom)
    branch(size)
end

function branch(length)
    length = length * 0.68    --reduce the length of the branch
    if (length < 2) then return end  --exit if too short
    for i=0, 1 do
        pushMatrix()
        rotate(angle)
        line(0, 0, 0, length*zoom)
        translate(0, length*zoom)
        branch(length)    --recursive call
        popMatrix()
        angle = -angle    --draw symmetrical branch
    end
end

How spiffy. I love that you accomplished this in so little code.

Wonderful–instructive on many levels.

(Still digging through my old graphics textbook, and just getting to vectors again. Hey, the older I get, the slower I am. But recursion always makes me smile. :smiley: )