Open mestaritonttu opened 4 years ago
Sorry for responding with such a long delay. Great work! I am not sure how would I go about using it, because there are 2 files, so plain SVG export goes out of the window. I am not 100% sure, but I think SVG files can have Githubissues.
I thought it would be nice to have player controls for the exported SVG animations. I had recently worked with the very nice termtosvg and I realised that its player could be quite easily modified to work with enve's SMIL output.
I added the player elements and styles into the SVG. The JS code is not very elegant, I tried to clean it up as best I could. One minor issue is that after you scrub the animation, the mouseup event usually does not fire. This is also seen in the original termtosvg player. It works after clicking outside the slider.
I only tested this with a very simple animation, so I am not sure how robust the JS code is. If you like the idea of offering such a player optionally, I guess you could allow for some customisation like autoplay and looping.
Regarding accessibility:
The
The
There is a
The player controls have aria-hidden="true" (otherwise the screen reader will make noise about them being "clickable")
I tested with NVDA on Windows and it read the element just as I wanted. My intention is to create animations with subtitle-like text, so screen reader users have access to what is essentially being presented.
I took some tips from Deque's article Creating Accessible SVGs and elsewhere.
Note that if you want to try my example locally, you have to disable same origin policy in your browser because it loads the SVG into an object element. Instructions for Chrome, Firefox.
Thanks a lot for creating enve!
The SVG:
The HTML & JS: