Share JSXGraph: example "Animation of lines"

JSXGraph
Share JSXGraph: example "Animation of lines"
This website is a beta version. The official release will be in **2024**.

Animation of lines

The point `p0` controls the movement of the line. The coordinates of `p0` define a transformation (translation). This transformation is applied to the points `p1` and `p2`. which in turn define the line to be animated. Of course, in applications `p0` should be hidden
Click here, to start animation
<span onClick="startAnimation()" style="color:blue">Click here, to start animation</span>
// Define the id of your board in BOARDID

const board = JXG.JSXGraph.initBoard(BOARDID, {
    boundingbox: [-10, 10, 10, -10],
    axis: true
});
var p0 = board.create('point', [0, 0], {
    name: 'T',
    trace: true
});
var p1 = board.create('point', [7, 5], {
    name: 'A',
    trace: true
});
var p2 = board.create('point', [5, 7], {
    name: 'B',
    trace: true
});
var l = board.create('line', [p1, p2], {
    name: ''
});

var t = board.create('transform', [function() {
    return p0.X();
}, function() {
    return p0.Y();
}], {
    type: 'translate'
});
t.bindTo([p1, p2]); // The translation is bound to the points, but the points are not updated, yet

function startAnimation() {
    p0.moveTo([-5, -8], 1500);
}