Snippet

A Snippet is a reusable bit of markup for your pattern. Snippets are added to the SVG defs section, and rendered with the SVG use tag.

Signature

Javascript
Snippet new Snippet(String def, Point anchor);

The snippet constructor takes two arguments:

  • def : The xlink:href id that links to the relevant entry in the SVG defs section. This is also the common name of the snippet (logo, notch, button, etc.)
  • anchor : A Point on which to anchor the snippet

Properties

A Snippet object comes with the following properties:

  • def : The xlink:href id that links to the relevant entry in the SVG defs section
  • anchor : A Point on which to anchor the snippet
  • attributes : An Attributes instance holding the snippet’s attributes
RELATED

See Using Attributes for information about custom Attributes that can be used with Snippets.

Example

Methods

A Snippet object exposes the following methods: