WLJS LogoWLJS Notebook

SVGAttribute

Supports Offload

Allows to directly set SVG attribute to a 2D graphics object

SVGAttribute[object_, "name"->"value"]

Please see the SVG docs for all possible attributes. In principle it should work with most 2D primitives, since all of them are SVG elements.

Example

If we want a dashed line

Graphics[
	SVGAttribute[
		Line[{{-1,-1}, {1,1}}]
	, "stroke-dasharray"->"3"]
]

Make it blurry

Graphics[
	SVGAttribute[
		SVGGroup[{
			Red, Disk[{0,0}, 0.5],
			Blue, Line[{{-1,-1}, {1,1}}]
		}]
	, "style"->"filter: blur(10px)"]
]

On this page