Even tho it's 8y old, Sarah Drasner's famous "SVG Can Do That?" talk is still eye-opening for many. CSS has matured a ton since then (I'm less sure about SVG per se)... in any case it's HIGHLY recommended.
One fun thing that can be done with SVG files: you can use entities in an inline DTD to define constants to be shared across different places in the file. You can see some great examples of this in the SVGs in David Ellsworth's "Squares in Squares" page [0].
The major browsers have no issues with this, though note that some tools like Inkscape won't parse the DTD nor expand the entities.
You say "entities" but that term is actually the name for SGML/XML's mechanism to define arbitrary syntactic content for reference/reuse with entity references a la &ref, whereas in SVG you can park shapes/paths/whatever under refs, giving those an id attribute value, and then <use> those element in the body SVG content, which is also what the page you linked is using (for each individual SVG ie. there's no sharing of rectangles across the many pictures since these are pulled-in individually via <embed> inot their own DOM rather than used as inline SVG).
I wonder why SVG's original designers found it necessary to supply an ad-hoc re-implementation of the entity mechanism. I think it might have to do with how rendering properties can be overridden at the usage site? At least I don't think it was established that browsers ignore entity definitions or basically anything in the document prolog/DOCTYPE considering SVG was part of W3C's push to replace HTML's SGMLish legacy syntax with XHTML/XML.
Maybe I am missing something, but can't find any !doctype or !element that would represent a DTD on that page. If you are talking simply about SVG defs and use - that isn't a DTD.
"A Deep Dive Into SVG Path Commands" by Nanda Syahrasyad [0] is really great for understanding how SVG paths are composed. It's from almost 2 years ago now and really opened my eyes to all that SVGs can do and exactly how they're doing it.
I worked on a project that did something fun with SVGs like this. It was built with React, and we had a series of still illustrations with an animated element, with its colour controlled by a CMS.
The frontend would basically call an API that would return an SVG image with the right colour assigned and the animation done by hiding and showing svg elements.
I really miss Macromedia Flash. There wasn't a single tech like Flash and SWF format which flourished with so many indie games and animated movies available without any extra downloads (other than Flash Player). Barier to entry was so low.
Now, take SVG, it has potential to do everything what SWF could. But there is no editor like Flash and scene/object based coding solution like ActionScript. And each browser has own quirks so only simple SVG is guaranteed to be displayed everywhere.
Well it still exists as Adobe Animate which can export to html.
Comparing SVG to Flash seems like an apples to oranges comparison anyway. The format does not have to do everything that Flash did but can rely on the other technologies in the browser.
Complex animated SVG is fun to roll until you get into the weeds of SMIL and Safari bricks your phone for missing a leading 0 on a float or some random nonsense.
Is there any SVG extension which allows density of line? I have a plotter which can lift/lower a pen; it's driven from SVG files. It'd be sweet to allow the pen to lower while the line is being drawn (as we often do with handwriting).
Oh - it's an Axidraw, from Evil Mad Scientist Labs - great device, wonderful people.
It's pretty easy to store custom instructions in plain SVG files and interpret them in with your reader. For example I have a multi-purpose laser-cutter / plotter and I use opacity for laser power, stroke weight for movement speed, green channel for number of passes, blue channel for z-axis height and red channel for lowering the pen or turning of the laser etc.
I always thought transforms were an odd inclusion in SVG until I tried to make my own icons/logo with it. Those curves are challenging to get right. When I got done with the second logo I decided it looked flat and I needed to skew it 10°. The thought of rewriting all of those lines and curves suddenly made rotation seem like a much much better idea. Good thing too because it looked weird next to test and I changed the angle several more times to make the kerning look right.
SVG feels like a very underexplored and underused territory. You can do so many things with it. It really depends on your imagination. But you’ll possibly need to “hardcore” a lot of stuff, so yeah, depends on the use case as well.
It's a fun format that's easy to generate, but after trying to do complicated things with it.. you kind of understand why. It's underused b/c
- Complex graphics render different in different browsers. So you can't rely on it shows up the same (never had the same issue with a PDF for example)
- There are quite a few renderers but they typically don't implement large parts of SVG b/c it's too complex.. So you can never really be sure what parts are "safe" to use.
- Large complex graphics display extremely slowly (again, compared to a PDF)
- There is basically one editor.. Inkscape. And it's got it's own quirks and doesn't match Chrome/Firefox's behavior. Ex: You can add arrows to lines in Inkscape and they don't display in Firefox
It's also just got too many weird corner case limitations. For instance you can embed a SVG in another SVG (say to make a composite diagram). But you can't embed a SVG in to an SVG in to an SVG. On the web if you inline or link an SVG you also end up with different behaviors
- adding toolpath information so as to use Flash as the engine for a Computer Aided Manufacturing tool: https://github.com/Jack000/PartKAM
- (this was my project along w/ Edward R. Ford) adding hyperlinks to part lists to highlight parts in an assembly diagram: https://github.com/shapeoko/Docs --- unfortunately, that doesn't seem to work anymore.
SVG+CSS is super powerful, a simple feature that I love is making diagrams respect dark/light mode, without any javascript. Check the diagrams here for example: https://blog.davidv.dev/posts/ipvs-lb/
That landing page is a nauseatingly laggy experience on a very powerful M1 Pro laptop. And slow to load, all for some fancy lines? I'd take a product that focuses on substance over style as dev. Don't get me wrong, style is important and I like pretty things, but here it seems the tradeoff is not well done.
> laggy experience on a very powerful M1 Pro laptop
Apple's M series chips aren't really all that powerful, but they are very power efficient. There are far faster laptops out there than what Apple offers, though they do consume more power. My AMD-based laptop outperforms the M1 Pro by a wide margin, though it is a power hog. I had no problem viewing the Unkey website. If you're using Safari, that may also be a problem, because Safari honestly sucks.
For as long as SVG's been around its potential feels untapped. I can't think of any other element that can encapsulate functional HTML, CSS and JS -- basically an entirely different HTML document -- as easily
SVG feels much like HTML to me, especially when animations are involved: on the first sight it is quite nice and simple, does its job well, can be handled by fairly basic viewers (as well as converters, editors) and generated easily. Then there are even more features with CSS and JS, which also look neat, but then simplicity goes away, along with it goes the wide support of full functionality, and compatibility (due to partial support, unexpected behaviors in different contexts). It still looks like a fine option when animations are needed, but I would rather avoid those in SVG when they are not necessary.
One nice thing about SVGs is that they can be connected to the dom, you can do css, and easier to debug than canvas. Performance is the only thing holding it back from making declarative code for plotting and mapping charts.
Maybe I'm in the minority, but I wish there were an similarly popular vector drawing format that did much much less than SVG. Any time you want to support vector drawings in a project, the obvious approach is to support SVG...which basically means you have to bring in the equivalent of a browser. What is the minimal alternative?
I love what you have done here — it's very graceful.
I was feeling great but now I think "I have a lot to learn — I'd better get going!"
If you are interested in SVG animation, I wrote a program to do it from within Adobe Illustrator — see examples and how it works at https://svija.com/en/animation
I wrote a game of Tetris in JavaScript with SVG many years ago. It had nice graphics and was smoothly animated. I hadn’t heard of anyone else using SVG like that at the time.
Fun to see how apparent boundaries can be pushed or broken with clever use of lesser known features.
That said, most of this is probably better done with CSS today.
My only professional exposure to SVG was when a pen tester found my predecessor's code had unintentionally allowed them, and that one can do injection attacks from the SVG itself. Of course this was around the time a client discovered SVG worked for them, so I had to make support official and defeat injection attacks. Good times.
This taught me that SVGs can be animated with CSS. Cool!
I wonder if anybody has recreated vector graphics games like Asteroids using SVGs and animation. You'd have to use JS to change the shape and direction of the asteroids when they're shot, but that would just require a bit of JS.
I discovered this shortly after introducing The Secret of Kells to a child and had terrible, beautiful ideas about overly ornate websites that I have since thought better of. Mostly.
Haven't done much recently, but I do really like SVG. I did a fun project for a grid scale battery company in 2017. I generated graphical reports of battery status and health. I used a .Net extension in Sql Server to generate the graphics from the database.
i'll be a contrarian, that css and svg "hacks" like this are "impressive" are a symptom of a web-platform that is dogshit for multimedia. If a game did this nobody would even blink, the fact that it's another convoluted css hack makes it "notable".
Regular LLMs are quite bad at it (see simonwillison's blog post). However this paper [0] describes an apparently sound approach using Neural Radiance Fields (NeRFs), however their github repo [1] has been "code coming soon!" for months now, so you can't really use it.
In at least my limited experience, they're kind of bad. They can retrieve shapes that already exist, sometimes inaccurately, but they are less reliable at creating novel ones
chrisweekly|10 months ago
Slides: https://slides.com/sdrasner/svg-can-do-that
Video: https://youtu.be/ADXX4fmWHbo?si=6YPZkopyEDc8PSte
jamra|10 months ago
LegionMammal978|10 months ago
The major browsers have no issues with this, though note that some tools like Inkscape won't parse the DTD nor expand the entities.
[0] https://kingbird.myphotos.cc/packing/squares_in_squares.html
tannhaeuser|10 months ago
I wonder why SVG's original designers found it necessary to supply an ad-hoc re-implementation of the entity mechanism. I think it might have to do with how rendering properties can be overridden at the usage site? At least I don't think it was established that browsers ignore entity definitions or basically anything in the document prolog/DOCTYPE considering SVG was part of W3C's push to replace HTML's SGMLish legacy syntax with XHTML/XML.
lenkite|10 months ago
timewizard|10 months ago
https://developer.mozilla.org/en-US/docs/Web/SVG/Reference/E...
noahbald|10 months ago
E.g. Billion laughs attack https://en.wikipedia.org/wiki/Billion_laughs_attack
znpy|10 months ago
joshuaturner|10 months ago
[0] https://www.nan.fyi/svg-paths
baosoy|10 months ago
The frontend would basically call an API that would return an SVG image with the right colour assigned and the animation done by hiding and showing svg elements.
You can see an example here: https://web.archive.org/web/20221020133516im_/https://uncrow...
imhoguy|10 months ago
Now, take SVG, it has potential to do everything what SWF could. But there is no editor like Flash and scene/object based coding solution like ActionScript. And each browser has own quirks so only simple SVG is guaranteed to be displayed everywhere.
7952|10 months ago
Comparing SVG to Flash seems like an apples to oranges comparison anyway. The format does not have to do everything that Flash did but can rely on the other technologies in the browser.
jefozabuss|10 months ago
The problem is that each of these apps can be quite bloated and in the tens of MBs range not the usual single digit MB.
mettamage|10 months ago
unknown|10 months ago
[deleted]
braebo|10 months ago
hansvm|10 months ago
benjanik|10 months ago
all2|10 months ago
CliffStoll|10 months ago
Oh - it's an Axidraw, from Evil Mad Scientist Labs - great device, wonderful people.
m-a-t-t-i|10 months ago
WillAdams|10 months ago
I've been doing that sort of thing in:
https://github.com/WillAdams/gcodepreview
hinkley|10 months ago
danielstocks|10 months ago
vunderba|10 months ago
https://boardgamegeek.com/boardgame/333/waterworks
danielstocks|10 months ago
chrisweekly|10 months ago
two_handfuls|10 months ago
perilunar|10 months ago
rckt|10 months ago
geokon|10 months ago
- Complex graphics render different in different browsers. So you can't rely on it shows up the same (never had the same issue with a PDF for example)
- There are quite a few renderers but they typically don't implement large parts of SVG b/c it's too complex.. So you can never really be sure what parts are "safe" to use.
- Large complex graphics display extremely slowly (again, compared to a PDF)
- There is basically one editor.. Inkscape. And it's got it's own quirks and doesn't match Chrome/Firefox's behavior. Ex: You can add arrows to lines in Inkscape and they don't display in Firefox
It's also just got too many weird corner case limitations. For instance you can embed a SVG in another SVG (say to make a composite diagram). But you can't embed a SVG in to an SVG in to an SVG. On the web if you inline or link an SVG you also end up with different behaviors
WillAdams|10 months ago
- adding toolpath information so as to use Flash as the engine for a Computer Aided Manufacturing tool: https://github.com/Jack000/PartKAM
- (this was my project along w/ Edward R. Ford) adding hyperlinks to part lists to highlight parts in an assembly diagram: https://github.com/shapeoko/Docs --- unfortunately, that doesn't seem to work anymore.
wwweston|10 months ago
perilunar|10 months ago
memhole|10 months ago
deivid|10 months ago
Voultapher|10 months ago
That landing page is a nauseatingly laggy experience on a very powerful M1 Pro laptop. And slow to load, all for some fancy lines? I'd take a product that focuses on substance over style as dev. Don't get me wrong, style is important and I like pretty things, but here it seems the tradeoff is not well done.
leptons|10 months ago
Apple's M series chips aren't really all that powerful, but they are very power efficient. There are far faster laptops out there than what Apple offers, though they do consume more power. My AMD-based laptop outperforms the M1 Pro by a wide margin, though it is a power hog. I had no problem viewing the Unkey website. If you're using Safari, that may also be a problem, because Safari honestly sucks.
deads1mple|10 months ago
https://www.unkey.com/
RobotToaster|10 months ago
fitsumbelay|10 months ago
For as long as SVG's been around its potential feels untapped. I can't think of any other element that can encapsulate functional HTML, CSS and JS -- basically an entirely different HTML document -- as easily
defanor|10 months ago
perilunar|10 months ago
Sun Clock: https://sunclock.net
Degrees What?: https://degreeswhat.com
gocsjess|10 months ago
notnullorvoid|10 months ago
yowzadave|10 months ago
AndrewSwift|10 months ago
I was feeling great but now I think "I have a lot to learn — I'd better get going!"
If you are interested in SVG animation, I wrote a program to do it from within Adobe Illustrator — see examples and how it works at https://svija.com/en/animation
rorads|10 months ago
rjinman|10 months ago
I also made a game called Pro Office Calculator (available on Steam), which includes a Doom-style 3D engine for which I used Inkscape as my map editor. Here’s an example of a map: https://github.com/robjinman/pro_office_calc/blob/develop/da...
enduser|10 months ago
paulryanrogers|10 months ago
That said, most of this is probably better done with CSS today.
My only professional exposure to SVG was when a pen tester found my predecessor's code had unintentionally allowed them, and that one can do injection attacks from the SVG itself. Of course this was around the time a client discovered SVG worked for them, so I had to make support official and defeat injection attacks. Good times.
kmoser|10 months ago
I wonder if anybody has recreated vector graphics games like Asteroids using SVGs and animation. You'd have to use JS to change the shape and direction of the asteroids when they're shot, but that would just require a bit of JS.
hinkley|10 months ago
https://youtube.com/watch?v=wc8ovZZ78SY
I discovered this shortly after introducing The Secret of Kells to a child and had terrible, beautiful ideas about overly ornate websites that I have since thought better of. Mostly.
mkoryak|10 months ago
unknown|10 months ago
[deleted]
intrasight|10 months ago
eMPee584|10 months ago
staindk|10 months ago
soup10|10 months ago
exabrial|10 months ago
aiibe|10 months ago
mvdtnz|10 months ago
xyst|10 months ago
xerox13ster|10 months ago
flaviuspopan|10 months ago
slow_turtle3|10 months ago
nshkrcom|10 months ago
[deleted]
snitty|10 months ago
What fresh hell is this?
perilunar|10 months ago
HTML attribute: height="20"
CSS property: height: 20px;
JS statement: element.style.height = "20px";
chentastic|10 months ago
krebby|10 months ago
https://simonwillison.net/2024/Oct/25/pelicans-on-a-bicycle/
simpaticoder|10 months ago
0 - https://arxiv.org/pdf/2501.03992
1 - https://github.com/SagiPolaczek/NeuralSVG
plumeria|10 months ago
pizza|10 months ago
qingcharles|10 months ago
jbreckmckye|10 months ago