Illustrating jsfiddle:
http://jsfiddle.net/Cleonis/y76d2xga/As you know, my graphlets are pretty much always animations, and pretty much always include a slider.
For the purpose of code organize I prefer to do all calculation in the 'playing' loop, with the graph elements simply calling the results of those calculations.
For example: if I want to make a point move along a circular trajectory I'd like to code in the playing loop:
x = Math.cos(angle);
y = Math.sin(angle);
And then for the moving point:
var p = board.create(
'point',
[x, y]
);
I tried that, but then the point doesn't move. I surmise that when executing a board.Update() JSXGraph does not update elements that have their coordinates in the above form.
To get the motion I have to code:
var p = board.create(
'point',
[function() {return x}, function() {return y}]
);
That is not a problem of course, but I'm always on the look for cleaner, more economical code. I'd like to have the short form available.
I'm guessing that you use the "function() {return x}" syntax as a triggering device, setting things up in such a way that if JSXGraph encounters the "function() {return xxx}" form it proceeds to recompute and redraw, rather than leave the element untouched. Am I guessing correctly?
Cleon Teunissen