VLEX (GitHub: indus / VLEX, License: MIT) by Stefan Keim is a library for defining the logic necessary to resize SVG images. It works using a
vlex attribute that controls how things are resized, and there's also a
VLEX function for initialising and updating elements.
A "vlexpression" contains property descriptions separated by semi-colons. Using a
$ allows predefined values to be referenced:
$x / 2 -- the horizontal centre. Using a colon allows a value to be set:
Given those rules, you can centre a circle with
Internally it splits the expression with
String.prototype.split(';'), and then splits on
: to get the keys and values. It's a fairly simple parser, but it seems small and flexible enough to do get some clever effects using SVG. Take a look at the examples in the readme to see what's possible.