logoalt Hacker News

StilesCrisistoday at 12:14 PM1 replyview on HN

Interactive like this? https://yqnn.github.io/svg-path-editor/

I still don't see your point. Why wouldn't I always choose SVG? What problem or pain point is being solved?


Replies

itishappytoday at 12:43 PM

It's not interactive for me:

https://codepen.io/ItIsHappy/pen/vEXrXxg

Yes, I'm being pedantic, but that was the point of my comment. SVGs aren't interactive by default, you need to bring your own interactivity.

For static content, SVGs work great, but for interactive content the additional sematic layer of JSON Canvas has a clear benefit. SVGs represent connections using paths, while JSON Canvas uses a graph. This means SVG cannot connect a single node to more than 2 adjacent nodes. If I want to draw arrows from Alice, Bob, and Charlie all to Dave, then I need to create a second Dave or reference to that location somehow. (You can see this in your sword example by moving one of the edge points. The sword delaminates because only two of the four edges at that point can be connected together.) SVG provides limited tooling for this, but it gets rather complicated rather quickly.

show 1 reply