Animation and Modifying Quadratic Bezier Curves

   



Key Constructs

You can create animation effects in ECMAScript functions by specifying four things. First, you need a time-out period (measured in milliseconds), such as the following global variable:

var shortPause  = 100.;

Second, you need to specify the function that will be invoked after a delay of shortPause milliseconds:

theTimeout = setTimeout("window.renderBezier()",                          shortPause);

Third, you need invoke the code that stops the animation, which you can embed in a simple ECMAScript function as follows:

function stopAnimation() {    window.clearTimeout(theTimeout); }

Fourth, you need to specify a mechanism by which the preceding function will be invoked in order to stop the animation. In the current example, this mechanism is provided by clicking on the rectangle defined below:

<rect        x="50" y="200"       width="100" height="50"       onclick="stopAnimation()"       fill="green"/>



   



Fundamentals of SVG Programming. Concepts to Source Code
Fundamentals of SVG Programming: Concepts to Source Code (Graphics Series)
ISBN: 1584502983
EAN: 2147483647
Year: 2003
Pages: 362

flylib.com © 2008-2017.
If you may any questions please contact us: flylib@qtcs.net