Mathematics equations and Desmos

The topic of synfig and mathematics/math functions has been widely discussed here. For example use of math functions, vectors in application of pseudo 3D etc. Use of math in other aspects here such as physics and others. I want to know what members think about Desmos calculator and how it can make the work in synfig esp. the work which require use of math. Equations, do you think the calculator can be useful in conjunction with synfig?? If so why / if not why ?? All ideas / suggestions/ thoughts are welcome.

Desmos uses an expression evaluator while Synfig uses converters and exported values to achieve calculations.
If you need a series of valeurs from a function that you would evaluate with Desmos, you could convert the formula to Excel format, then compute a series of discrete values in a spreadsheet.
Then you would report these values in Synfig as values used as references, the same as what you could achieve with a joystick plugin.
Maybe in the future it could be implemented an expression evaluator from Python but it would be easier if we had scripting abilities.

Scripting, as in, full-blown programming language, is not that important in my opinion.
The reason here is that it doesnā€™t make the program better, it just provides a very slow interface to manipulate sif files. I would understand if sif was a binary file format, but it just a plain XML that you can tackle in any language you prefer. I would completely replace it with the ā€œcall this user-defined script with the path to sif fileā€ and boom, the plugin system is ready (no need to be language specific).

Although, if youā€™re talking about scripting abilities through the ā€˜Convertersā€™ system, then I totally support it.

Maybe it would have been beneficial for people who are good with math, but I donā€™t know of any on this forum. Hell, people have hard time understanding ā€˜Dynamicsā€™ converterā€¦ Honestly, I am not sure there are many (if any) who uses Synfig for its math abilities right now.

Indeed this seems to be advanced synfig use

I think it would have very few uses, I donā€™t know if it would be easier to implement but just importing values from outside file could be better option. If someone is doing animation about math thereā€™s good chance they know basic programming and could just turn any function into frames and right values.
Basically file would look something like this

#frame value
12 3.141
13 3.257
14 3.586
...
1 Like

This could be done with a plugin.
For example, to create a (hidden) Polygon Layer, splitting the vectors of each Vertex with composite makes 2 Reals that could then be exported to be used as references.
Initial import and even updates could be easy, for every frame.
Even framerate, canvas size or number of vertices could be changed upon update.

Right? Besides, a person might prefer to work in a language itā€™s familiar with, be it Python, Perl, PHP, Lua or even something like freaking Java. So your idea about providing a generalized interface such as ā€œanimation from fileā€ is a good point.

Oh wait, I just checked the source code of ā€œAnimation from fileā€ converter and I thought it was for pgo files only but itā€™s no longer the case! Someone actually implemented the functionality to import custom frames like you described. But itā€™s kinda clunky, it expects tsv format (tab separated file) instead of your typical csv (comma separated) which would be better since tabs are often replaced automatically by text editors, so manual editing of such file might be a pain.

Anyway, to get it working you need to:

  • Create a file with ā€œ.tsvā€ extension, e.g. ā€œanimation.tsvā€
  • Put ā€œTimemark \t Valueā€ structure on each line, example:
0s	0.0
1s	2.1
2s	3.5
  • Convert the desired value to ā€œAnimation from fileā€
  • Select your file and then scroll the timeline, there wonā€™t be any waypoints visible but value would change according to file

The sad thing is that itā€™s not documented. How do we expect user to experiment with new features if they donā€™t know how to use them? Documentation now is in the worst state than it was before, I swearā€¦

I checked it out and it doesnā€™t work for Synfig 1.4.4 (Linux) but it works for 1.5.1. From my experiments with it I gathered that:

  • .tsv extension in file name matters (even tho it shouldnā€™t)
  • First column doesnā€™t require ā€œsā€ after value
  • It does update automatically when file is changed
  • Fractions of seconds work but value at some point might overshoot if in file fraction of second is too small

Overall I like it but it really needs to be described on wiki because thereā€™s no way I would figure out it has to be tab separated. Others conversions also need description like bone link, which look like just ordinary bone to me, etc.

1 Like