Drawing Hilbert curves with SVG
Hilbert curves are a type of space-filling curve that can be constructed with the SVG polyline element, using a basic design and then aggregating.
I started by polylining one basic design into four sections of a graph, making the necessary adjustments to connect them up. This then becomes my main building block.
By taking the main building block and translating, rotating and scaling, the next-larger curve can be constructed. To flip a section, a negative scale value is used. The four sections are joined by three short line segments.
Then, do it again to make it bigger. If you connect the two ends at the bottom, you will have a closed curved which could be copied as an image and color filled.
Working with Paths
By changing the polyline to a SVG path element and connecting up the four lines, you can make a super path. Then add some SVG animated motion.
Here is another example of an animated path where I am animating two circles (one twice as fast as the other), one png image and one text string which only makes one circuit and then freezes.
Here is an example of an animated text path.
This article is licensed under a Creative Commons Attribution, Non Commercial - Share Alike 2.5 license.
Comments
The forum archive of this article is still available on My Opera.