Pattern1

Original demo by Vincent Hardy, published October 4, 2009.

Open Pattern1 in the gallery

This small demo shows what the SVG pattern element can do when its tile is vector artwork rather than a bitmap. A rectangle is filled with a tile of squares and dots in the spirit of op art. The large word svg sits on top, filled with exactly the same pattern and perfectly aligned, so it cannot be seen.

Moving the pointer changes the paint. Over the rectangle, the text switches to an inverted version of the pattern and the letters appear. Over the letters themselves, the fill becomes an orange version with a white stroke and a blurred drop shadow from an SVG filter. Moving away returns the word to hiding.

The original script cloned the text element after every change to work around a Firefox bug from 2009. That bug is long gone, and the swap could disturb hover events, so the workaround was removed. The restoration also adds a font fallback, a viewBox so the demo scales, and a keyboard control that steps through the three states.

This note was newly written for the reconstruction. Read the original post in the Internet Archive.

Topics: Pattern, Interactive