88

SVG.js v3.2

It’s 10x slower than vanilla which makes this an ideal use case for transpilation.

I bet you could just take one afternoon to write a vite plugin

a day agopyrolistical

What is the use case of this library given that vanilla JS is 10x faster?

a day agomaxloh

Maybe it's ease of development, and resulting readability?

I did enjoy the example code, compared to the native javascript (both shown in the article):

  var draw = SVG().addTo('#drawing')
    , rect = draw.rect(100, 100).fill('#f06')
a day agoelygre

why would the native JavaScript not be something like (probably errors here, so like, not necessarily this precisely)

const div = document.getElementById('drawing');

div.innerHTML = `<svg width="100%" height="100%"><rect width="100" height="100" fill="#f06"/></svg>`;

obviously if the what is going in can have user input in some way then open to attack using innerHTML but otherwise it seems like the structure of the example native JavaScript is made in such a way as to make the SVG.js version seem super cool in comparison.

a day agobryanrasmussen

> Obviously not as fast as vanilla js

I had a similar question- why is it obviously not as fast as vanilla js?

a day agojasonjmcghee

Because it’s written in vanilla JS.

a day agocal85

Perhaps non-browser usage?

a day agoaabhay

I typically use d3 for any generated SVGs.

a day agodagss

Anyone know a Python library for manipulating SVG images?

a day agoemil-lp