Function graph animation: Difference between revisions
From JSXGraph Wiki
A WASSERMANN (talk | contribs) No edit summary |
A WASSERMANN (talk | contribs) No edit summary |
||
Line 6: | Line 6: | ||
var start = -4, | var start = -4, | ||
end = 4, | end = 4, | ||
turtle = brd.create('turtle', [ | x = start, | ||
step = 0.2, | |||
turtle = brd.create('turtle', [x, f(x)]); | |||
var moveForward = function() { | |||
x += step; | |||
if (x>end) { | |||
return; | |||
} | |||
turtle.moveTo([x, f(x)]); | |||
setTimeout(moveForward, 50); | |||
}; | |||
turtle.hideTurtle(); | |||
moveForward(); | |||
</jsxgraph> | </jsxgraph> |