Skip to main content

SVGAttribute

WLJS
Execution environment
Supports dynamics

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)"]
]