Stuart Carter

Recursive Coding: Animated Fern In Nineteen Lines

Today we’re looking at recursive programming, one of the best ways to get beautiful natural forms from very simple code. Here are the magic nineteen lines of code: float a=0; void setup() { fullScreen(P2D); } void draw() { background(255); stroke(0); draw_fern(width/2,height,height/10,0.05,0.03,0); a+=0.02; } void draw_fern(float x, float y, float r, float theta, float curve, int it) { float x2=x+sin(theta)*r; float y2=y-cos(theta)*r; if (r>1) { line(x,y,x2,y2); draw_fern(x2,y2,r*.90,theta+curve,curve+sin(a-it*0.2)*0.005, it+1); draw_fern(x2,y2,r*.3,theta+1.1,curve,it+1); draw_fern(x2,y2,r*.35,theta-1.2,curve,it+1); } }

My Simple Phone

◼ After years of pings, rings and dings, I decided to pare back my phone to the bare minimum. No longer a distraction. No longer calling to me twenty-four hours a day, tempting me to check the next message, or what’s going on with my friends. Six simple apps… audiobook, notepad, timer, phone, text and calendar. I was tempted to downgrade to a dumb phone, but the calendar is vital