3 ms·
Chromium has already implemented part of the SVG 2 spec that gives you CSS properties for most SVG attributes (not just the presentation attributes). This makes
by jancsika 8y ago
Chromium has already implemented part of the SVG 2 spec that gives you CSS properties for most SVG attributes (not just the presentation attributes). This makes it way easier to manipulate things directly, as you can set "width" and "height" props for a <rect> and it will display the way you always thought it should.
Additionally, you can animate those props using the Web Animations API. Something like this is quite nice:
```
myRect.animate(
{ "y": [0, 20, 0] },
{ duration: 1000, easing: "ease-in-out" }
);
```
There's a polyfill for the burgeoning Web Animations API. Once Edge and FF implement these CSS props for SVG, it should be possible to seriously suggest doing at least some of the more straightforward D3 demos in plain JS.
- WhitneyLand 8y agoThe production implementation is still way incomplete unfortunately. But your point is well taken and getting going with polyfills where possible is a great idea. Things will be much nicer when this all gets filled out and consistent across engines.