Hello to you all,
I have a rather difficult subject to submit.
Animations are easy to create under JSXGraph, for example with a moveto. I used this feature a lot of times and it works as expected.
But today I had an additional need. I wanted to illustrate some geometrical construction, that mathematicians call 'with ruler and compasses'. This subject is very interesting going as far as algebraic and transcendental field extensions and I think that in the past I will need to illustrate a lot of them and i decided to begin, with something simple, construct the 'mediator of a segment, according to the well known method known from Antiquity.
So to be demonstrative and attractive such construction have to bring 'real' tools, rulers, pencils, compasses, (as images) use them to draw lines, remove them, bring new ones, etc.. etc..
This leads to sequential animations if you want to have everything automatized.
Actually I was not successful with all the techniques I know up to now. When a few animations are programmed they always start together (simultaneously). If you try to use flags as global variables for communication between them either they continue to start together, or only the first one starts. To sum up after you have launched a 'moveto' you don't control anything about its execution, and I couldn't find any way to delay the start of the second till the first is completed.
So I began to ask my 'friend' Google what he knew about this subject.
First, it's clear that I'm not the only one to have such question.
I could read a lot of suggestions, some of them using the JQuery library. I discarded all of these because I don't want to use anything extra (JSXGraph and MathJax is enough).
Some solutions didn't work at all.
One was working with very simple examples here:
http://stackoverflow.com/questions/11416850/sequential-animations-in-javascriptI tried to apply to my case, but unfortunately I wasn't successful. Maybe the mechanic of moveto conflicts with the techniques used here but it was impossible to manage this
synchronism problem.
I searched the JSXGraph doc but didn't find anything.
I remember that I managed very well this case with Geogebra applets (they use mainly sliders for animation). Solution consisted in using one and only one 'dummy' slider controlling the process, which animation to activate was decided by the range of the value of the slider with a case of switch.
In pure Java Swing or AWT applets it was possible to use threads and communication between them because Java supports multi-thread programming not allowed by JS as far as I know.
Here I use a slider point to control the process (the 'moveto' concerns this point), since this point should make 'jumps' on the same figure or even jump from one figure to another, I couldn't imitate what I did with GeoGebra.
So after a few hours of work I decided to choose 'event driven' technique with use of buttons. in this case it's the user who fires the animations one after the other. Actually this is not bad because it's less passive, but I would like to have the choice : fully automatic or user (event) driven.
Result is here:
http://gilles.dubois10.free.fr/geometrie_affine/euclihymed.htmlNow my question is :
Is there a simple (or not simple) way inside the JSXGraph library to manage sequential animations ?
If not, does anybody here know a trick of JS programming that would work with the library ?
Thank you !
Gilles