# Difference between revisions of "Function graph animation"

From JSXGraph Wiki

Jump to navigationJump to searchA WASSERMANN (talk | contribs) |
A WASSERMANN (talk | contribs) |
||

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> |