I was pretty proud of being able to get everything into 5k until the JS1k contest launched this month and got me wondering how much smaller I could go.
The answer is 640 bytes.
Some of the savings come from not supporting Internet Explorer and removing unneeded functionality like color schemes. Others come from using
canvas instead of absolutely positioned
div elements. There's also a lot of optimizations including some neat modulo arithmetic (like
x=x<0?w-1:x%w) and a new algorithm using less data (which means less code).