Drawing in the Browser (2009).
Introduction.I once wrote a trivial Windows program to draw the 'Dragon Curve'. The source code got lost along the way, and I could not remember exactly how I had done it. This was annoying me, so I attempted to retrace my steps, and I think I got, more or less, to the same algorithm. When it came to drawing it though, I didn't fancy creating yet another Windows executable, but wanted to draw it on a web page.
All you need is a line in your file like:
The Dragon Curve implementation.So anyway you include the funny line, but otherwise your page can be just as it would be for Firefox el al. Here's the Dragon Curve:
Demo.The only snag with this appproach is that if you draw a Dragon Curve of greater that order 12, IE6 crashes - I can't speak for later versions. Also it's a bit slow compared to the genuine canvas tag. Here's what it does - order 12, so it should work in IE:
Since the actual graphics coding is trivial - moveTo(), lineTo() ... I may use the [if IE] trick to draw the curve directly using VML and see how that works with a higher order. But anyway, I learned some new things.