| 
  • If you are citizen of an European Union member nation, you may not use this service unless you are at least 16 years old.

  • You already know Dokkio is an AI-powered assistant to organize & manage your digital files & messages. Very soon, Dokkio will support Outlook as well as One Drive. Check it out today!

View
 

JavaScript Snippet - Animation

Page history last edited by Marc Renault 15 years, 1 month ago

 

See Spirograph example.

 

In this example, a slider representing variable "t" is animated.  The "mode" of animation (whether animation is looped forward, backward, or oscillating) can only be set in the GeoGebra program and cannot be modified with JavaScript.

 

 

<form name="myForm">

 

  <input value="Play/Pause" onclick="PlayPause()" type="button">      

  Speed: <input type="text" name="spd" size=2 value="1">  (1 = normal speed)

 

</form>

 

<script type="text/javascript">

 

function PlayPause() {

    var applet = document.ggbApplet;

    var speed = document.myForm.spd.value;

   

    applet.setAnimating("t", true); 

    applet.setAnimationSpeed("t", speed); // repeat these lines for all objects to be animated

   

    if (applet.isAnimationRunning()) {

        applet.stopAnimation();

    }

    else {

        applet.startAnimation();

    }

}

 

</script>

 

 

 

Comments (0)

You don't have permission to comment on this page.