Matt Sweetman

Latest articles

Javascript 1K demo

Lattice of Love screenshot

Lattice of Love is my submission for this year's JS1K competition. The theme is 'love' so a heart seemed appropriate.

The lattice pattern is based on a hypotrochoid, better known to many kids as a Spirograph. Instead of rolling the cog around a circle I've rolled it around a heart shape, which is be described using the heart curve equation. I've used a couple of Canvas bitmap operations to provide a slight blur and after-image, which help smooth out the visual appearance.

The code was optimized and compressed using Google's Closure Compiler, which got it down to 813 bytes - nicely under the 1K limit.

You can check out the source code here: