Table of Contents Previous Chapter Summary Chapter Viewpoint Slideshow Javadoc for translated .java source Next Chapter Summary X3D Resources

X3D Example Archives: X3D for Web Authors, Chapter 09 Event Utilities Scripting

IntegerSequencer example:  Road Work Ahead!

Event-utility nodes allow conversion and connection of different data types via ROUTEs, while Script nodes allow authors to write their own event-handling code for special scene capabilities.

Event utility nodes simplify data-type conversion of events when producing animation chains between nodes. These include BooleanFilter, BooleanSequencer, BooleanToggle, IntegerSequencer, IntegerTrigger, and TimeTrigger nodes.

The quick-reference sheet X3D Event Utility Nodes: Field Event Diagrams illustrates the functionality of the event utility nodes. These nodes receive and pass values that are sent via ROUTE connections.

The Script node allows authors to define new functionality produced by JavaScript (ECMAscript) or Java code. Authors can add field declarations that define accessType (inputOnly, outputOnly, initializeOnly and inputOutput) and type for each field.

The supporting Chapter 9 slideset and course videos (NPS, YouTube) for X3D for Web Authors are available online via X3dGraphics.com.

Also available: X3D Scene Authoring Hints for Scripts and URL Links.

  28 X3D Scenes       Scene Descriptions
BackgroundColorArrayAnimation Background Color Array Animation Design pattern demonstrating type conversion from single SFColor value (sent from a ColorInterpolator node) to an MFColor array (in a Background node).
BooleanFilterPumpHouse Boolean Filter Pump House A BooleanFilter node starts the animation of cones orbiting near the pump house, instead of an unfiltered TouchSensor toggling the animation on/off during selection/deselection.
BooleanSequencerIntegerSequencer Boolean Sequencer Integer Sequencer Show synchronized use of BooleanSequencer and IntegerSequencer nodes for SpotLight enabled and Switch whichChoice control, respectively
BooleanSequencerPumpHouse Boolean Sequencer Pump House A BooleanSequencer node intermittently interrupts animation of the pump house.
BooleanToggle Boolean Toggle A BooleanToggle button determines whether an animated Cone is jittery or not.
BooleanTogglePumpHouse Boolean Toggle Pump House A BooleanToggle node controls pump house animation: select to stop, then select again to restart.
BooleanTriggerPumpHouse Boolean Trigger Pump House Positive-displacement cylinder pump to emulate breakers surge, designed and built by David Packard.
CircleLinesExample Circle Lines Example Example circle and cross-hairs made out of line segments, autogenerated by a simple Java program.
CircleLinesExample60 Circle Lines Example 60 Example circle and cross-hairs made out of line segments, autogenerated by a simple Java program.
CircleLinesSphereLatitude Circle Lines Sphere Latitude Build a sphere outline by using multiple CircleLine circles as latitude rings, with actual semitransparent Sphere and axes added as a visualization hint.
CircleLinesSphereLongitude Circle Lines Sphere Longitude Build a sphere outline by using multiple CircleLine circles as longitude rings, with actual semitransparent Sphere and axes added as a visualization hint.
ElevationGridSimpleWaveAnimation Elevation Grid Simple Wave Animation Simple Javascript animation of ElevationGrid
IntegerSequencerPumpHouse Integer Sequencer Pump House An IntegerSequencer node switches the display of colored cones near the pump house.
IntegerSequencerRoadSignSwitcher Integer Sequencer Road Sign Switcher Switch among different road signs using IntegerSequencer
IntegerTrigger Integer Trigger An IntegerTrigger node controls the display of colored text.
IntegerTriggerPumpHouse Integer Trigger Pump House An IntegerTrigger node controls the display of colored cones near the pump house.
MoodSelector Mood Selector Design pattern demonstrating multiple TouchSensor, IntegerTrigger, Shape and ROUTE combinations for selecting a Switch
newECMAscriptTest new ECMAscript Test Example scene providing a unit test for newECMAscript template javascript source code, first load this scene and then see console for test output.
ScriptComplexStateEvents Script Complex State Events A lamp with 4 intensities (off low medium high) and a push-button switcher, all controlled by a Script node.
ScriptControlEvents Script Control Events A three-way light controlled by a Script node.
ScriptEvents Script Events A Script node drives the position and orientation of orbiting cones near the pump house.
ScriptEventsPumpHouse Script Events Pump House A Script node provides the path and orientation animation for three cones that orbit near the pump house.
ScriptNodeEventOutControlEcmaScript Script Node Event Out Control Ecma Script Script node interface between X3D and EcmaScript: this conformance example tests event-based X3D-EcmaScript functionality.
ScriptNodeFieldControlEcmaScript Script Node Field Control Ecma Script Script node interface between X3D and EcmaScript: this conformance example tests field-based X3D-EcmaScript functionality.
ScriptSimpleStateEvents Script Simple State Events A Script node drives an animated push button that turns a light on and off.
TestScriptInitialization Test Script Initialization Test ability to perform Script initialize() method using ECMAsript
TimeTriggerPumpHouse Time Trigger Pump House Pump house animation activated by a TimeTrigger node.
TimeTriggerTest Time Trigger Test Test of TimeTrigger node.

Online at http://X3dGraphics.com/examples/X3dForWebAuthors/Chapter09EventUtilitiesScripting

Validate XHTML 1.1

Master source code archive is under subversion control at
http://sourceforge.net/p/x3d/code/HEAD/tree/www.web3d.org/x3d/content/examples/X3dForWebAuthors/Chapter09EventUtilitiesScripting

Table of Contents Previous Chapter Summary Chapter Viewpoint Slideshow Javadoc for translated .java source Next Chapter Summary X3D Resources

Also available: current and archived nightly builds and distributions of these examples, all published under an Open-Source License.

The X3D Resources: Examples page and Savage Developers Guide provide more information about the production of this archive.