Live data from Hacker News

SVG can do that?

slides.com

121–130 of 202 posts

Re: SVG can do that?

#121
post #116

Earlier quoted context omitted.

performance degrades to <10fps above 2k nodes (2k random circles in an svg) for me regardless of browser

What are you doing with them? Animating them?

nothing - only changing the transform matrix on the root for pan/zoom

Re: SVG can do that?

#122

SVG works so fantastically well with React -- it's just part of the DOM, after all. Unless there are performance concerns, that reason alone would make me choose it over Canvas every time. Shameless plug, one of my first experiments with SVG+react (+cljs): https://polymeris.github.io/carlos/ Done in one day, without knowing the tech.

When I started learning React, I realised a dream of mine could finally come true: a proper Celtic Knotwork generator. Uses SVG and React together in harmony. http://celtic-knotwork.online

That's delightful, thank you for posting it!

Re: SVG can do that?

#123
post #20

SVG is good as long as it's not abused. All the kb saving are meaningless with performance issues caused by lots of nodes, gradients, etc. It's great for responsive icons, but for a full interactive UI with illustrations bitmaps are the better choice IMO unless you really need dynamic scaling. Just because you can do it doesn't mean you should.

Beware of using it for responsive icons. Popular browsers render SVG icons orders of magnitude slower than fonts, with the same vector content and scalability.

I recently had to convert an entire UI from SVG icons to fonts + bitmaps because the performance had gone down the drain, with just a few dozen different icons.

Re: SVG can do that?

#124

This showcases what's wrong with SVG: It does way too much! To be useful as a vector image format, there should be strict rules (and less cruft). Why is there no libsvg like libjpeg or libpng? Why have interaction as part of an image format? SVG lives in an uncanny valley between jpeg and flash/js. I think there is still a big need for a real vector interchange and display format. Right now people pick a "good" subse…

But how to deal with things like line-wrapping, when fonts have unknown size? Somehow, it should be possible to programmatically determine how each line is broken up. A similar argument holds for hinting at low pixel sizes.

This means it is inevitable that SVG should be Turing-complete.

Re: SVG can do that?

#125
post #36

It's always been a curiosity of mine why SVG didn't get more attention from browsers through the years to solve the performance issues. It's open source, cross platform, "dynamic" in a sense AKA no compiling needed, light weight, supports shapes and text, offers immediate responsiveness, etc. Why the lack of love while we pour ever increasing energy into mangling HTML and CSS and every six months a new JS framework/m…

The problem with SVG 1.1 is, that it doesn't support text wrapping. Text wrapping came with SVG 1.2 Tiny years later, but this standard had been ignored at that time. Then came HTML5.

Re: SVG can do that?

#126

One of funnest projects I worked on at Corel was called "Smart Graphics Studio" (I'm guessing most of the people who worked on it also read HN, so "Hi!"). It was an absolutely stupid idea: Some insane PGM read that XSLT could transform any XML into any other XML. Then they read that SVG was XML. They put 2 and 2 together and got a billion: You could draw a picture in SVG and then modify it intelligently (through XSLT…

It's such a shame that XSLT has such a poor image - v1.0 was troublesome for sure, but the modern language is remarkably flexible, expressive and elegant, as long as you leave your procedural baggage at the door. It's not without its wobbly bits, but show me a language that isn't.

SOAP, RDF and the semantic web clique, and other monstruosities of the 2000s gave XML a bad name but XSLT is nice. Indeed it would have been a nicer solution than responsive css to tackle the challenges of mobile devices.

Re: SVG can do that?

#127

One of funnest projects I worked on at Corel was called "Smart Graphics Studio" (I'm guessing most of the people who worked on it also read HN, so "Hi!"). It was an absolutely stupid idea: Some insane PGM read that XSLT could transform any XML into any other XML. Then they read that SVG was XML. They put 2 and 2 together and got a billion: You could draw a picture in SVG and then modify it intelligently (through XSLT…

It's such a shame that XSLT has such a poor image - v1.0 was troublesome for sure, but the modern language is remarkably flexible, expressive and elegant, as long as you leave your procedural baggage at the door. It's not without its wobbly bits, but show me a language that isn't.

I used XSLT on a project. I came from a functional mindset. XSLT is terrible and deserves its poor image.

Re: SVG can do that?

#128
post #126

Earlier quoted context omitted.

It's such a shame that XSLT has such a poor image - v1.0 was troublesome for sure, but the modern language is remarkably flexible, expressive and elegant, as long as you leave your procedural baggage at the door. It's not without its wobbly bits, but show me a language that isn't.

SOAP, RDF and the semantic web clique, and other monstruosities of the 2000s gave XML a bad name but XSLT is nice. Indeed it would have been a nicer solution than responsive css to tackle the challenges of mobile devices.

Amen. And while we're at it, let's throw some of the credit to XPath. Wouldn't you like concise, declarative traversal for your data structures? (Yeah, I'm sure somebody's already built it.)

I don't think I agree about responsive css, but that's another discussion.

Re: SVG can do that?

#129
post #91

Earlier quoted context omitted.

I think GP was referring to the fact that you don't need to generate SVG assets at multiple sizes for size/picture clarity balance, as you do with popular raster formats.

But GP was asking : "Why the lack of love while we pour ever increasing energy into mangling HTML and CSS" SVG can't be, shouldn't be and never will be the replacement for HTML/CSS/JS.

SVG is the replacement for HTML when you're doing something graphical in nature, styling it with css and animating with js. I've always felt that there was a huge potential in SVG for building UI.

Re: SVG can do that?

#130
post #117

Earlier quoted context omitted.

But GP was asking : "Why the lack of love while we pour ever increasing energy into mangling HTML and CSS" SVG can't be, shouldn't be and never will be the replacement for HTML/CSS/JS.

But GP's point is the opposite, that HTML/CSS/JS is being used too often for tasks that could be much more simply solved by SVG. I can think of a couple just in my current project.

Cool, could you please explain what are they? To me, personally, SVG is the last resort.
Post reply on HN