Difference between revisions of "Function graph animation"

From JSXGraph Wiki
Jump to navigationJump to search
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 08:25, 31 October 2012