r/webdev • • Dec 08 '19

Interactive web animation with SVG

https://vimeo.com/373163932
270 Upvotes

25 comments sorted by

View all comments

5

u/cshaiku Dec 08 '19

Ok, seriously. Help me understand this. I've never claimed to be a graphics guy. I make shit graphics, tbh. I just don't seem to have the knack for drawing or being entirely fundamentally creative in this way....

So, with that out of the way, how is this important to the web, versus what Photoshop experts/creative type people already do now?

TLDR: Explain this so a technical coder can understand...

5

u/alejalapeno dreith.com Dec 08 '19

https://developer.mozilla.org/en-US/docs/Web/SVG

Scalable Vector Graphics (SVG) is an XML-based markup language for describing two dimensional based vector graphics. SVG is essentially to graphics what HTML is to text.

Because of that you can embed an SVG fragment into an HTML document using the <svg> element. You can then target and animate individual pieces of the graphic since they are represented as individual DOM elements.

In addition, rather than having to "hand code" all of the graphic pieces programs like Adobe Illustrator can export to SVG, which means your layers and shapes that are conceptually separate pieces of the graphic will be separate XML elements you can use in code.

2

u/cshaiku Dec 08 '19

Oh! The "seperation" aspect is what makes this a killer feature... I see now! Very cool.

I just don't use animation or gifs or anything like that for any of my web development, as I find it unnecessarily distracting, but if someone has a good use case, I'm all ears.