The chaos game in <canvas>

This is just a small and very simple chaos game written in JavaScript for the <canvas> element. It works in Firefox and Safari. Just an experiment – I have been reading “Introducing Fractal Geometry” (Icon Books 2000 / Totem Books 2001), which looks like it is written for 12-year olds – with big illustrations and short, simple phrases – but can only be fully understood by university mathematics students (i.e. not me). At least I got the bit on the chaos game!

Good values are attractors: 3 and attraction: 1/2 (Serpinski Gasket) and attractors: 6 and attraction: 2/3 (Serpinski hexagon).