4 ms·
SVG Tetris
- marcodiego 6y agoSvg supports the <script> tag. This allows for some very interesting usages. Other examples: https://www.scriptol.fr/xml/code/invaders.svg https://www.scriptol.fr/xml/code/invaders.svg 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-... https://upload.wikimedia.org/wikipedia/commons/6/6c/Morphing_SMIL.svg https://upload.wikimedia.org/wikipedia/commons/6/6c/Morphing...
- bawolff 6y agoThe last one is using SMIL (declarative animations) not a <script> tag. Wikipedia doesnt let you upload svgs that embed javascript.
- john-doe 6y agoAnother example, a simple calendar: https://shkspr.mobi/blog/2018/02/this-svg-always-shows-todays-date/ https://shkspr.mobi/blog/2018/02/this-svg-always-shows-today...
- upofadown 6y ago>Svg supports the <script> tag. This allows for some very interesting usages. That raises the question of how one disables the <script> tag on one's browser to prevent the most interesting usages.
- jancsika 6y agoIIRC an svg as the src of an img won't run the script. But it used to be that if you chose "View Image" on the SVG, then it would run the script when it opens the svg in its own window. Not sure if that's still true.
- nayuki 6y agoI first saw your comment on this topic a few weeks ago: https://news.ycombinator.com/item?id=26115086 https://news.ycombinator.com/item?id=26115086
- commandlinefan 6y agoThe controls here are maddening though - I kept expecting the down button to drop the piece rather than rotate it.
- JellyBeanThief 6y agoI prefer the up button to rotate clockwise myself.
- NiceWayToDoIT 6y agoMe too, space should rotate and arrow down should drop.
- NiceWayToDoIT 6y ago"Look Maa it is image, it is game, it is web page ..." :) I thought oh I cannot believe this it is again one of those supper advance CSS, and then a saw javascript. Never the less, still cool!
- croisillon 6y agoCan’t do much on mobile, except with an old blackberry i guess. Do you intend to add touch controls as well?
- chungy 6y agoIf you do a page info, you'll note the SVG was created in 2007. Highly doubtful anyone is going to update it. It was a neat tech demo at the time, but we do have better ways to implement Tetris on the web now (possibly then, too)
- mkl 6y agoLooks like it's even earlier. From the page source: <!-- SVG Tetris for SVG-enabled Mozilla --> <!-- (c)2004 alex fritze <alex@croczilla.com> -->
- ChrisArchitect 6y agoRight, this was a famous SVG demo example from 2004 stored on http://www.croczilla.com/svg/samples/svgtetris/svgtetris.svg http://www.croczilla.com/svg/samples/svgtetris/svgtetris.svg for many years
- amelius 6y agoBut they disabled the Control + and - keybindings so you can't zoom in!
- kroltan 6y agoThey consume every event, even reloading the page is impossible without reaching for the UI buttons.
- deleted 6y ago[deleted]
- imhoguy 6y agoScore 102! SVG as a new Flash? Thankfully open standard.
- deleted 6y ago[deleted]