Mutually dependent line and gliders: Difference between revisions
From JSXGraph Wiki
A WASSERMANN (talk | contribs) No edit summary |
A WASSERMANN (talk | contribs) No edit summary |
||
Line 12: | Line 12: | ||
var gl1 = board.create('glider', [0,0, el0], {name:'b'}); | var gl1 = board.create('glider', [0,0, el0], {name:'b'}); | ||
var gl2 = board.create('glider', [1,0, el1], {name:'a'}); | var gl2 = board.create('glider', [1,0, el1], {name:'a'}); | ||
var line = board.create('line', [ | var line = board.create('line', [gl1, gl2]); | ||
line.draggable = function() { return true; }; | |||
var offset = gl2.Y() - gl1.Y(); | var offset = gl2.Y() - gl1.Y(); | ||
Line 22: | Line 22: | ||
gl2.on('drag', function() { | gl2.on('drag', function() { | ||
offset = gl2.Y() - gl1.Y(); | offset = gl2.Y() - gl1.Y(); | ||
}); | }); | ||
</jsxgraph> | </jsxgraph> |