Snap.svg wraps SVG DOM operations and animation for browsers, supporting masks, gradients, groups, and loading SVG from strings or design tools.
Overview
Snap.svg is a client-side JavaScript library focused on scalable vector graphics in modern browsers. It provides an API reminiscent of jQuery for selecting, creating, and transforming SVG elements while exposing newer SVG features such as masking, clipping, patterns, and gradients.
You can author SVG programmatically or import artwork from tools like Adobe Illustrator, Inkscape, or Sketch, then query fragments asynchronously to build sprites. An animation library and event helpers are meant to make interactive vector graphics easier to drive from code.
Distribution includes minified and uncompressed builds loaded from a script tag or bundled through webpack with imports-loader configuration. The project ships under an Apache 2 license and is documented at snapsvg.io with getting started guides and API reference material.
Typical uses include data visualization, interfaces that need resolution-independent graphics, and enhancing static SVG assets with scripted behavior in the browser.
Key features
- SVG DOM manipulation API
- Masking, clipping, and patterns
- Animation and event handling
- Load external SVG strings
- Sprite extraction from SVG files
- Script tag or webpack bundling
Use cases
- Interactive web vector graphics
- Animating Illustrator or Inkscape SVG
- Building resolution-independent UI graphics