Fun With Javascript - Part I

A Twitterable Xmas Tree in 140 characters


It ain't much, but it's cute:

for(x=w=3,y=38;x++<w||(x=-w,--y);)document.write("<i style=position:fixed;color:#",y<32?(w=y/2,190):840,";left:",x+16,";top:"+y+">.</i>")

Gets you this:

xmas tree 1

Click here to see in your browser

This one's psychedelic:

for(x=w=3,y=39;x++<w||(x=-w,--y);)document.write("<i style=position:fixed;color:#",y<32?(w=y/2,x*y+512):0,";left:",x+16,";top:"+y+">.</i>")

Gets you this:

xmas tree 2

Click here to see in your browser

I have other variants laying around, like one with 'decorations' and animated variants, but they're longer than 140 characters, and therefore fail the twitter test.

Yes, I could probably be spending my time better.