| 1 | <?xml version="1.0" encoding="UTF-8"?> | 
| 2 | <!DOCTYPE X3D PUBLIC "ISO//Web3D//DTD X3D 3.3//EN" "https://www.web3d.org/specifications/x3d-3.3.dtd"> | 
| 3 | <X3D profile='Immersive' version='3.3' xmlns:xsd='http://www.w3.org/2001/XMLSchema-instance' xsd:noNamespaceSchemaLocation='https://www.web3d.org/specifications/x3d-3.3.xsd'> | 
| 4 | <head> | 
| 5 | <meta name='title' content=' TimeSensorChaining.x3d '/> | 
| 6 | <meta name='description' content='Connecting TimeSensor nodes so that the completion of one behavior chain triggers another.'/> | 
| 7 | <meta name='creator' content='Don Brutzman and MV3204 class'/> | 
| 8 | <meta name='created' content='2 September 2009'/> | 
| 9 | <meta name='modified' content='27 August 2023'/> | 
| 10 | <meta name=' warning ' content=' under development '/> | 
| 11 | <meta name='identifier' content=' https://www.web3d.org/x3d/content/examples/X3dForWebAuthors/Chapter07EventAnimationInterpolation/TimeSensorChaining.x3d '/> | 
| 12 | <meta name='generator' content='X3D-Edit 4.0, https://www.web3d.org/x3d/tools/X3D-Edit'/> | 
| 13 | <meta name='license' content='../license.html'/> | 
| 14 | </head> | 
 DEF nodes index: 
               
               Clock1,
Clock2,
Clock3,
Clock3CompleteTrigger,
ClockReversal,
DoorColor,
DoorColorInterpolator,
DoorHingeTransform,
DoorOpenComplete,
DoorOpener,
MiddleJustify,
SetTextClosed,
SetTextInMotion,
SetTextOpen,
TextAppearance,
TextSwitcher,
TriggerOpeningAnimation,
UserSelectDoor
               
               
                  DEF nodes index: 
               
               Clock1,
Clock2,
Clock3,
Clock3CompleteTrigger,
ClockReversal,
DoorColor,
DoorColorInterpolator,
DoorHingeTransform,
DoorOpenComplete,
DoorOpener,
MiddleJustify,
SetTextClosed,
SetTextInMotion,
SetTextOpen,
TextAppearance,
TextSwitcher,
TriggerOpeningAnimation,
UserSelectDoor
| 15 | <Scene> | 
| 16 | <WorldInfo title='TimeSensorChaining.x3d'/> | 
| 17 | <Viewpoint description='TimeSensor chaining example' position='0 1 6'/> | 
| 18 | 
          <!-- ROUTE information for DoorHingeTransform node: 
[from DoorOpener.value_changed to rotation
                        ]
 --> <Transform DEF='DoorHingeTransform' center='-0.65 0 0' translation='0 1 0'> | 
| 19 | 
               <!-- ROUTE information for UserSelectDoor node: 
[from touchTime to Clock1.startTime
                              ]
[from isActive to SetTextInMotion.set_boolean
                              ]
[from touchTime to Clock3.startTime
                              ]
 --> <TouchSensor DEF='UserSelectDoor' description='click to operate door'/> | 
| 20 | <Shape> | 
| 21 | <Box size='1.3 2.5 0.08'/> | 
| 22 | <Appearance> | 
| 23 | 
                         <!-- ROUTE information for DoorColor node: 
[from DoorColorInterpolator.value_changed to diffuseColor
                                          ]
 --> <Material DEF='DoorColor' diffuseColor='1 0 0'/> | 
| 24 | </Appearance> | 
| 25 | </Shape> | 
| 26 | </Transform> | 
| 27 | <Transform scale='0.6 0.6 0.6' translation='0 -1 0'> | 
| 28 | 
               <!-- ROUTE information for TextSwitcher node: 
[from SetTextInMotion.triggerValue to whichChoice
                              ]
[from SetTextOpen.triggerValue to whichChoice
                              ]
[from SetTextClosed.triggerValue to whichChoice
                              ]
 --> <Switch DEF='TextSwitcher' whichChoice='0'> | 
| 29 | <Group> | 
| 30 | <Shape> | 
| 31 | <Text string='"Door is closed"'> | 
| 32 | 
                                   <!-- FontStyle
                                                      MiddleJustify is a DEF node that has 2 USE nodes: USE_1, USE_2 --> <FontStyle DEF='MiddleJustify' justify='"MIDDLE" "MIDDLE"'/> | 
| 33 | </Text> | 
| 34 | 
                              <!-- Appearance
                                                TextAppearance is a DEF node that has 2 USE nodes: USE_1, USE_2 --> <Appearance DEF='TextAppearance'> | 
| 35 | <Material/> | 
| 36 | </Appearance> | 
| 37 | </Shape> | 
| 38 | </Group> | 
| 39 | <Group> | 
| 40 | <Shape> | 
| 41 | <Text string='"Door in motion..."'> | 
| 42 | <FontStyle USE='MiddleJustify'/> | 
| 43 | </Text> | 
| 44 | <Appearance USE='TextAppearance'/> | 
| 45 | </Shape> | 
| 46 | </Group> | 
| 47 | <Group> | 
| 48 | <Shape> | 
| 49 | <Text string='"Door is open"'> | 
| 50 | <FontStyle USE='MiddleJustify'/> | 
| 51 | </Text> | 
| 52 | <Appearance USE='TextAppearance'/> | 
| 53 | </Shape> | 
| 54 | </Group> | 
| 55 | </Switch> | 
| 56 | </Transform> | 
| 57 | <!-- ===== open the door ===== --> | 
| 58 | 
          <!-- ROUTE information for Clock1 node: 
[from UserSelectDoor.touchTime to startTime
                        ]
[from fraction_changed to DoorOpener.set_fraction
                        ]
[from isActive to DoorOpenComplete.set_boolean
                        ]
[self-route from isActive to enabled
                        ]
 --> <TimeSensor DEF='Clock1' cycleInterval='2'/> | 
| 59 | < ROUTE fromNode='UserSelectDoor' fromField='touchTime' toNode='Clock1' toField='startTime'/> | 
| 60 | 
          <!-- ROUTE information for DoorOpener node: 
[from Clock1.fraction_changed to set_fraction
                        ]
[from ClockReversal.value_changed to set_fraction
                        ]
[from value_changed to DoorHingeTransform.rotation
                        ]
 --> <OrientationInterpolator DEF='DoorOpener' key='0 0.5 1' keyValue='0 1 0 0 0 1 0 4.7124 0 1 0 3'/> | 
| 61 | < ROUTE fromNode='Clock1' fromField='fraction_changed' toNode='DoorOpener' toField='set_fraction'/> | 
| 62 | < ROUTE fromNode='DoorOpener' fromField='value_changed' toNode='DoorHingeTransform' toField='rotation'/> | 
| 63 | 
          <!-- ROUTE information for SetTextInMotion node: 
[from UserSelectDoor.isActive to set_boolean
                        ]
[from triggerValue to TextSwitcher.whichChoice
                        ]
 --> <IntegerTrigger DEF='SetTextInMotion' integerKey='1'/> | 
| 64 | < ROUTE fromNode='UserSelectDoor' fromField='isActive' toNode='SetTextInMotion' toField='set_boolean'/> | 
| 65 | < ROUTE fromNode='SetTextInMotion' fromField='triggerValue' toNode='TextSwitcher' toField='whichChoice'/> | 
| 66 | <!-- ===== door is now open ===== --> | 
| 67 | 
          <!-- ROUTE information for DoorOpenComplete node: 
[from Clock1.isActive to set_boolean
                        ]
[from inputFalse to TriggerOpeningAnimation.set_boolean
                        ]
[from inputFalse to SetTextOpen.set_boolean
                        ]
[from inputFalse to Clock3.enabled
                        ]
 --> <BooleanFilter DEF='DoorOpenComplete'/> | 
| 68 | < ROUTE fromNode='Clock1' fromField='isActive' toNode='DoorOpenComplete' toField='set_boolean'/> | 
| 69 | <!-- disable Clock1 by turning itself off when complete --> | 
| 70 | < ROUTE fromNode='Clock1' fromField='isActive' toNode='Clock1' toField='enabled'/> | 
| 71 | 
          <!-- ROUTE information for TriggerOpeningAnimation node: 
[from DoorOpenComplete.inputFalse to set_boolean
                        ]
[from triggerTime to Clock2.startTime
                        ]
 --> <TimeTrigger DEF='TriggerOpeningAnimation'/> | 
| 72 | < ROUTE fromNode='DoorOpenComplete' fromField='inputFalse' toNode='TriggerOpeningAnimation' toField='set_boolean'/> | 
| 73 | 
          <!-- ROUTE information for Clock2 node: 
[from TriggerOpeningAnimation.triggerTime to startTime
                        ]
[from fraction_changed to DoorColorInterpolator.set_fraction
                        ]
 --> <TimeSensor DEF='Clock2' cycleInterval='0.5'/> | 
| 74 | < ROUTE fromNode='TriggerOpeningAnimation' fromField='triggerTime' toNode='Clock2' toField='startTime'/> | 
| 75 | 
          <!-- ROUTE information for SetTextOpen node: 
[from DoorOpenComplete.inputFalse to set_boolean
                        ]
[from triggerValue to TextSwitcher.whichChoice
                        ]
 --> <IntegerTrigger DEF='SetTextOpen' integerKey='2'/> | 
| 76 | < ROUTE fromNode='DoorOpenComplete' fromField='inputFalse' toNode='SetTextOpen' toField='set_boolean'/> | 
| 77 | < ROUTE fromNode='SetTextOpen' fromField='triggerValue' toNode='TextSwitcher' toField='whichChoice'/> | 
| 78 | 
          <!-- ROUTE information for DoorColorInterpolator node: 
[from Clock2.fraction_changed to set_fraction
                        ]
[from ClockReversal.value_changed to set_fraction
                        ]
[from value_changed to DoorColor.diffuseColor
                        ]
 --> <ColorInterpolator DEF='DoorColorInterpolator' key='0 0.5 1' keyValue='1 0 0 0.1 0.1 0.1 0.203922 0.701961 0'/> | 
| 79 | < ROUTE fromNode='Clock2' fromField='fraction_changed' toNode='DoorColorInterpolator' toField='set_fraction'/> | 
| 80 | < ROUTE fromNode='DoorColorInterpolator' fromField='value_changed' toNode='DoorColor' toField='diffuseColor'/> | 
| 81 | <!-- ===== close the door ===== --> | 
| 82 | 
          <!-- ROUTE information for Clock3 node: 
[from UserSelectDoor.touchTime to startTime
                        ]
[from DoorOpenComplete.inputFalse to enabled
                        ]
[from fraction_changed to ClockReversal.set_fraction
                        ]
[from stopTime to Clock3CompleteTrigger.set_triggerTime
                        ]
[self-route from isActive to enabled
                        ]
 --> <TimeSensor DEF='Clock3' cycleInterval='2' enabled='false'/> | 
| 83 | < ROUTE fromNode='UserSelectDoor' fromField='touchTime' toNode='Clock3' toField='startTime'/> | 
| 84 | <!-- enable Clock3 once door is fully open --> | 
| 85 | < ROUTE fromNode='DoorOpenComplete' fromField='inputFalse' toNode='Clock3' toField='enabled'/> | 
| 86 | <!-- disable Clock3 by turning itself off when complete --> | 
| 87 | < ROUTE fromNode='Clock3' fromField='isActive' toNode='Clock3' toField='enabled'/> | 
| 88 | 
          <!-- ROUTE information for ClockReversal node: 
[from Clock3.fraction_changed to set_fraction
                        ]
[from value_changed to DoorOpener.set_fraction
                        ]
[from value_changed to DoorColorInterpolator.set_fraction
                        ]
 --> <ScalarInterpolator DEF='ClockReversal' key='0 1' keyValue='1 0'/> | 
| 89 | < ROUTE fromNode='Clock3' fromField='fraction_changed' toNode='ClockReversal' toField='set_fraction'/> | 
| 90 | < ROUTE fromNode='ClockReversal' fromField='value_changed' toNode='DoorOpener' toField='set_fraction'/> | 
| 91 | < ROUTE fromNode='ClockReversal' fromField='value_changed' toNode='DoorColorInterpolator' toField='set_fraction'/> | 
| 92 | <!-- enable Clock1 when door is fully closed --> | 
| 93 | 
          <!-- ROUTE information for Clock3CompleteTrigger node: 
[from Clock3.stopTime to set_triggerTime
                        ]
[from triggerTrue to SetTextClosed.set_boolean
                        ]
 --> <BooleanTrigger DEF='Clock3CompleteTrigger'/> | 
| 94 | < ROUTE fromNode='Clock3' fromField='stopTime' toNode='Clock3CompleteTrigger' toField='set_triggerTime'/> | 
| 95 | 
          <!-- ROUTE information for SetTextClosed node: 
[from Clock3CompleteTrigger.triggerTrue to set_boolean
                        ]
[from triggerValue to TextSwitcher.whichChoice
                        ]
 --> <IntegerTrigger DEF='SetTextClosed' integerKey='0'/> | 
| 96 | < ROUTE fromNode='Clock3CompleteTrigger' fromField='triggerTrue' toNode='SetTextClosed' toField='set_boolean'/> | 
| 97 | < ROUTE fromNode='SetTextClosed' fromField='triggerValue' toNode='TextSwitcher' toField='whichChoice'/> | 
| 98 | </Scene> | 
| 99 | </X3D> | 
 DEF nodes index: 
         
         Clock1,
Clock2,
Clock3,
Clock3CompleteTrigger,
ClockReversal,
DoorColor,
DoorColorInterpolator,
DoorHingeTransform,
DoorOpenComplete,
DoorOpener,
MiddleJustify,
SetTextClosed,
SetTextInMotion,
SetTextOpen,
TextAppearance,
TextSwitcher,
TriggerOpeningAnimation,
UserSelectDoor
         
         
            DEF nodes index: 
         
         Clock1,
Clock2,
Clock3,
Clock3CompleteTrigger,
ClockReversal,
DoorColor,
DoorColorInterpolator,
DoorHingeTransform,
DoorOpenComplete,
DoorOpener,
MiddleJustify,
SetTextClosed,
SetTextInMotion,
SetTextOpen,
TextAppearance,
TextSwitcher,
TriggerOpeningAnimation,
UserSelectDoor
Event Graph ROUTE Table entries with 22 ROUTE connections total, showing X3D event-model relationships for this scene.
Each row shows an event cascade that may occur during a single timestamp interval between frame renderings, as part of the X3D execution model.
         <!--
Color-coding legend: X3D terminology 
<X3dNode
          DEF='idName' field='value'/> 
 matches XML terminology 
<XmlElement
          DEF='idName' attribute='value'/> 
(Light-blue background: event-based behavior node or statement)
(Grey background inside box: inserted documentation)
(Magenta background: X3D Extensibility)
          -->
      
         
             <!--
For additional help information about X3D scenes, please see X3D Tooltips, X3D Resources, and X3D Scene Authoring Hints.
-->
         
         <!--
For additional help information about X3D scenes, please see X3D Tooltips, X3D Resources, and X3D Scene Authoring Hints.
-->