Function graph animation: Difference between revisions

From JSXGraph Wiki
No edit summary
No edit summary
Line 6: Line 6:
   var start = -4,
   var start = -4,
       end = 4,
       end = 4,
       turtle = brd.create('turtle', [start, f(start)]);
      x = start,
      step = 0.2,
       turtle = brd.create('turtle', [x, f(x)]);


   turtle.hideTurtle()
   var moveForward = function() {
  turtle.moveTo([0,0]);
        x += step;
        if (x>end) {
            return;
        }
        turtle.moveTo([x, f(x)]);
        setTimeout(moveForward, 50);
    };
 
  turtle.hideTurtle();
  moveForward();
 


</jsxgraph>
</jsxgraph>

Revision as of 07:25, 31 October 2012