X3DX3D Graphics logo
buy now
Buy Now!

Mouse-over the figure to see a larger version. Please allow a little time for the larger image to download. Click on any of the figures to view a large version in a separate window.

  • Image Not Available - Figure 09-01
    Figure 9.1. Example Boolean Sequencer and IntegerSequencer scene graph and timing diagram. Together these show enabling and disabling a Spotlight, synchronized with choosing different children of a Switch.

  • Figure 9.2. An example use of BooleanFilter node to provide animation control to the rotating colored cones.

  • Figure 9.3. Example use of BooleanSequencer that turns the pump animation on and off. The piston jumps among the pictured positions through its animation cycle. The figure shows three successive views of the piston animation cycle.

  • Figure 9.4. Clicking on the pump house starts or stops the movement of the piston. The animation clock continues to run so the piston jumps when an "on" click occurs.

  • Figure 9.5. Example use of BooleanTrigger node to start animation in scene BooleanTrigger.x3d. The images show the initial state (left), shortly after the animation starts (middle), and nearing the end of the first animation cycle (right).

  • Figure 9.6. The IntegerSequencer node is used to sequentially display the colored cones in example IntegerSequencer.x3d.

  • Figure 9.7. Three IntegerTrigger nodes are used to switch between the three colored cones in example IntegerTrigger.x3d.

  • Figure 9.8. Three images from an animation cycle in example TimeTrigger.x3d. The animation is triggered by a click on the pump house. The animation stops after a cycle is complete. Subsequent clicks cause the animation cycle to restart.
  • Image Not Available - Figure 09-09
    Figure 9.9. The preferred form to embed ECMAscript code within a Script node using the XML encoding (.x3d files) is to contain a CDATA section within the Script elements.

  • Figure 9.10. An example use of a Script node to quickly process incoming events and generate outgoing events to procedurally animate the cones.

  • Figure 9.11. Events are connected with ROUTE statements between nodes for most animation. Scripts may also bypass the event model, either through directOutput control of other nodes or else SAI access of an external application (such as a web browser).

  • Figure 9.12. The Script node lifecycle begins with the initialize() method, is triggered when an event arrives, continues through an event cascade, repeats for each animation loop, and finally ends with the shutdown() method.

  • Figure 9.13. Use of a Script node to process incoming events and retain state between those events. The Script remembers the state of the 3-way bulb as shown in these four images. Sequential clicks on the red button cycle the light through various stages of brightness.

Portions of this work are from the book,
X3D: 3D Graphics for Web Authors, by Don Brutzman and Leonard Daly, published by Morgan Kaufmann Publishers, Copyright 2007 Elsevier, Inc. All rights reserved.