first working code with animated svg output, needs a bit more work
cleaned a bit