(I coded the above using equal parts Processing and black magic.)