I tried to find a suitable SVG library for modern browsers. My goal is to decide which library is suitable for creating a simple online SVG editor, for example. edit text and paths and crop text using paths.
I found two libraries that might be suitable: Snap.svg and Svg.js.
SNAP.SVG
Github: https://github.com/adobe-webplatform/Snap.svg
Source Codes: 6925 Github Stars: 3445
Doc: http://snapsvg.io/docs/
Getting started: http://snapsvg.io/start/
Starter Example ( JSBIN )
var draw = Snap(800, 600); // create image var image = draw.image('/images/shade.jpg', 0, -150, 600, 600); // create text var text = draw.text(0,120, 'SNAP.SVG'); text.attr({ fontFamily: 'Source Sans Pro', fontSize: 120, textAnchor: 'left' }); // clip image with text image.attr('clip-path', text);
SVG.JS
Github: https://github.com/svgdotjs/svg.js
Source Codes: 3604 Github Stars: 1905
Doc: https://svgdotjs.imtqy.com/
Starter Example ( JSBIN ):
var draw = SVG('drawing'); // create image var image = draw.image('/images/shade.jpg'); image.size(600, 600).y(-150); // create text var text = draw.text('SVG.JS').move(300, 0); text.font({ family: 'Source Sans Pro', size: 180, anchor: 'middle', leading: '1em' }); // clip image with text image.clipWith(text);
Usage seems pretty similar.
What are the main differences between the two libraries?
Timo Kähkönen Feb 15 '14 at 11:28 2014-02-15 11:28
source share