4 ms·
Article mentions svg supports <script> tag... Coolest use of it: https://www.xul.fr/svgtetris.svg https://www.xul.fr/svgtetris.svg
by marcodiego 6y ago
Article mentions svg supports <script> tag... Coolest use of it: https://www.xul.fr/svgtetris.svg https://www.xul.fr/svgtetris.svg
- schaefer 6y agoTetris in an SVG?!? I am in awe. I'm feeling equal parts: "this is beautiful", "this is perverse", and "I want to do this too"
- marcodiego 6y agoCool? Take a look at this: https://www.scriptol.fr/xml/code/invaders.svg https://www.scriptol.fr/xml/code/invaders.svg
- ComputerGuru 6y agoIt seems like the French have a passion for dynamic SVGs.
- edoceo 6y agoSpace Invaders! Amazing!
- kgwxd 6y agoIs that an example of SVG including a script tag or just manipulating the SVG DOM through javascript? I think that's 2 separate concerns. Browsers already understand both, I think the article puts it under "The Bad" category because if you're building a renderer from scratch, you'd need to also handle javascript and DOM stuff.
- dallamaneni 6y agoWow this is super amazing (and little horrifying). Never knew SVG can contain Javascript. Always thought of it as just a little safe vector graphics markup.
- Eisfunke 6y agoWow. I'm unsure whether I should be impressed or horrified. I've added the link to the article, thank you.
- ROARosen 6y agoI'm both
- deleted 6y ago[deleted]
- sjbrown 6y agoHere's a full-on dice roller / Virtual Tabletop that takes advantage of this: https://github.com/sjbrown/togetherness https://github.com/sjbrown/togetherness
- nayuki 6y agoLess impressively, a clock: https://www.nayuki.io/res/full-screen-clock-javascript/full-screen-clock-analog-with-seconds.svg https://www.nayuki.io/res/full-screen-clock-javascript/full-... (50 lines of code)
- shaftway 6y agoOh man. Way back in the long long ago I worked at Adobe. I was a test engineer on the SVG <script> tag, mostly making sure that the DOM methods all worked properly. Lots and lots of interesting micro-projects there. The one I was proudest of was a 3d chemical viewer where you could grab the molecule and spin it. SVG was only used because it was convenient to do the visualization. All of the 3d transforms were done in Javascript. But to have Javascript that could fluidly spin a 3d model was pretty amazing in 2000.
- rapidlua 6y agoFlameGraph [1] renders profiling results into svg. Profile is essentially hierarchical; a user can zoom into subtree by clicking an element. Probably not an inspiring use of script in svg; but boy, how handy this feature is! https://gist.githack.com/mejedi/90eac4f11f794f43808f90e38b1a18d4/raw/157203d11a9c813865017d0c38ba0af115a67765/g.svg https://gist.githack.com/mejedi/90eac4f11f794f43808f90e38b1a... [1] http://www.brendangregg.com/flamegraphs.html http://www.brendangregg.com/flamegraphs.html
- m463 6y agoI liked this one, hiding on wikipedia: https://upload.wikimedia.org/wikipedia/commons/6/6c/Morphing_SMIL.svg https://upload.wikimedia.org/wikipedia/commons/6/6c/Morphing... A morphing digital clock
- amenod 6y agoCool, thanks for sharing! FYI, the OP posted an update with a reply to you: > This article was posted on Hacker News... > In the comments there somebody mentioned an interesting use of the <script> tag in SVG. I’m unsure though whether I should be impressed or horrified :D