find some discussion about what's required to implement animation in different ways..


it all boiled down to either writing a bespoke animation engine or writing an SVG DOM

it turned out that the SVG DOM is a lot smaller and easier to implement than expected. this makes thew javascript path viable and gives a usable industry-standard API for third parties to use. One benefit of going the javascript route is that it makes it possible for interactive SVG to be written. this would take inkscape to the level of a flash replacement.

---------- Forwarded message ---------
From: NASA Jeff <tallboy258@gmail.com>
Date: Thu, 21 May 2020 at 16:06
Subject: Re: more svg animation updates.
To: inkscape-devel <inkscape-devel@lists.sourceforge.net>

SMIL 3.0 Animation

looking through  SMIL specification the key benefits over javascript are, not requiring a bulky,. 3rd part engine and simplicity of parsing. The downside are that you have to implement an animation engine, they are already available for js and SMIL complete and tested of you take the javascript path but once a bespoke animation engine has been created it can also be used for CSS another downside when compared to js is that SMIL isn't as feature-rich. it's also going to be fun reflecting changes of object details on the canvas with each animation in it own little thread and sometimes having keyframes sometimes not.

There's little difference in all the work to hook up the GUI between js and  SMIL, they support the same features and activities in general.


looking at the two roadmaps the traid off is the difficulty parsing javascript to extract the details of the animation vs the mission of implementing a bespoke animation engine. the javascript path also gives you both SMIL and javascript with little extra effort. Nothing is lost if the javascript in a file can't be parsed sufficiently well as inkscape would revert back to it's old self, with animation disabled, and just be an SVG editor. The javascript could also be edited in a code editor in inkscape and the play feature still available to play the animations, the javascript code editor could also have features designed for editing animation information meaning inkscape would still be better than nothing for js animation it just would have full GUI integration.


On Thu, 21 May 2020 at 15:10, NASA Jeff <tallboy258@gmail.com> wrote:
updated hypothetical road map foir the javascript path, I'll also use this as the basis for a road map for the SIML path, which I'll send shortly

reading thought it it wasn't the flour phase plan I put together prev just some basic ideas and a breakdown

my current proposal to implement SVG animation is as follows (i expect this list isn't exhaustive but I feel I have the majority of the critical components listed)  

as I went through the list of possible ways of implementing animation before SIDL isn't possible due to lack of support from Microsoft and plans to drop support by google.(there is now a shim to do this so it's no longer an issue)
css seems a bit limiting, especially for those hardcore flash fanboy animators that have been begging for animation to be implemented.
leaving us with javascript which is feature rich and allowing people to hand-edit javascript in inkscape has to be considered but there is an alternative of only allowing editing through the GUI and making the javascript read-only. It remains to be seen how common a problem complex or bizarre javascript usage is, if it's detectable then inkscapes animation features can be turned off selectively preventing any attempts at interpreting the meaning of the javascript. inkscape then just reverse to an SVG editor for the files in question
there is a hypothetical risk of viruses being spread by svg files that implement javascript but I think this can be mitigated against by limiting the exposure of the hosts API and potentially which lists for what to allow javascript to load via import routines.

a javascript implementation allows the animation to be implemented in phases, the first phase is to implement the javascript engine and ensure all the relevant hooks are in place and an inkscape API for javascript has been created. I expect that the API shim can be generated via a script keeping the task accurate and timely. I've not reviewed Inkscape's codebase to see if this is a possibility.

it makes sense at this time to slightly extend the feature set so as to support javascript macros, I make various arguments bellow including cost-effectiveness. security fort macros and svg would require than the javascript engine can  isolate running macros and running svg
the next phase is loading svg files and parsing the javascript to extract positioning and animation information from it, the user interface also needs to be extended sot hat values can be read and written
following on from the there is a requirement of creating new javascript via the GUI and updating/replacing the existing script

the next phase requires that the javascript is hooked up to the objects on the canvas enabling them to be animated


a simple code editor also needs to be implemented, but I wouldn't go beyond the basics otherwise people may be tempted to write apps in inkscsape.

the final phase is a a timeline navigator with support for keyframes and layers needs to be created
the ability to go to any frame, step through and preview play SVG files and their animation needs to be added.
animation parameters need to be, get, set and updated for the keyframes

fake smile could then be used to implement SIML on top of the already written javascript implementation, 
SIML would have to be parsed and integrated into the GUI  

finally with all in place and tested a CSS implementation can be compleated.

one of the benefits of this implementation is that javascript engines already exist and are well tested so complex parsers and interpreters don't have to be created, 
fake smile  exists and is well tested it could be used to implement  SIML on top of javascript keeping  the number of implementations down  and limiting bugs etc...  it should also be a lot faster than a standalone  SIML  implementation. There are also libraries available and tested that implement SVG animation via javascript


On Sat, 16 May 2020 at 03:01, NASA Jeff <tallboy258@gmail.com> wrote:
I didn't manage to catch up wiith anyone on irc yet, and i only managed to catch up with the scribes team tonight as my irc client was buggy. short of a programming task I';ve been working on my psychology project.

hopefully, any day soon, I will begin implementing the PDF import routines in Inkscape internal with Scribus, this is my first mini project to do and after growing through the code it doesn't appear it should take too long unless there's major issues implementing multipage/full document import.

after this, I'm free to spend the majority of the considerable amount of free time i have on Inkscape..

sorry I repeat the same thing a couple of times in a couple of places because I added a couple of paragraphs that added background that the reader may not be familiar with or remembered.

 I've been thinking some more about the best way to implement SVG animation and I would also include +UI as in makes sense to implement some interactive features that would allow the SVG files to be used too create user interfaces for games and apps, though actually creating games and apps insider Inkscape is out of scope so a full flash feature set won't be available without third-party apps.  


my current proposal to implement SVG animation is as follows (i expect this list isn't exhaustive but I feel I have the majority of the critical components listed)  

as I went through the list of possible ways of implementing animation before SIDL isn't possible due to lack of support from Microsoft and plans to drop support by google.
css seems a bit limiting, especially for those hardcore flash fanboy animators that have been begging for animation to be implemented.
leaving us with javascript which is feature rich and if animations readonly and the feature set reduced should be no more difficult to pull the element numbers from than CSS would as both would need custom parsers as they are not xml.

a javascript implementation allows the animation to be implemented in two phases, the first phase is to implement the javascript engine and ensure all the relevant hooks are in place and an inkscape API for javascript has been created. it makes sense at this time to slightly extend the feature set so as to support javascript macros, I make various arguments bellow including cost-effectiveness.

aside from hooking up a javascript engine within Inkscape an API for Inkscape's functionality is also required to allow javascript and Inkscape to interact. My current plan goes along the lines of hickaking inkscapes undo/redo features and extending and generalizing them so that when a macro is set to be recorded a call to add something onto the undo stack writes the equivalent of a redo to the macro file buffer.

why bother implementing javascript powered macros?
a javascript engine would have to be integrated into inkscape for it to efficiently support anyway
trigers on updates would have to be extended so as to write values to keyframes anyway, it is fairly trivial to write out a line in a macro file at the same time.
a macro engine allows for relatively easy testing that hooks are in place, the API is correct, the javascript engine is properly integrated etc...
it also makes it possible to test that animation features are working correctly even if the UI hasn't been fully implemented.
it's not a major job so why not most of the functionality would be needed for animation anyway and it allows for the implementation and testing to be done in two phases.
it makes testing and debugging much easier and will probably save more time and headaches than it cost to create.

a simple code editor also needs to be implemented, but I wouldn't go beyond the basics otherwise people may be tempted to write apps in inkscsape.

at the same time as doing this I intended to write a guide to implementing macro engines in computer software with undo redo support. maybe with a nicely packaged up javascript engine and API starter kit. it makes sense to do this so that others are encouraged to add this kind of functionality to applications once they realize that it's relatively straight forward and not as complicated as one may think.



undo redo hooks need to be extended again but this time to write javascript for animation not for macros, calls to append to the undo buffer should now additionally update the values at keyframes

Inkscapes user interface needs to be extended to add any animation-related data, this should update undo which will then populate the relative animation setting in the animation script.


a timeline navigator with support for keyframes and layers needs to be created
the ability to go to any frame, step through and preview play SVG files and their animation needs to be added.


javascript used for animation should have a restricted set of javascript functionality. it should be viewable but read-only. I would allow it to be extended using scripts with a predefined interface, these scripts should be editable but only allow for a reduced set of javascript functionality. they are there to make script extendable and customizable and to implement features that inkscape doesn't implement for whatever reason.



a parser needs to be created to scrape the relevant bits of javascript so as to import the animation values into the gui where they can then be edited and updated.