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='Interactive' 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='BooleanToggleExample.x3d'/> |
6 | <meta name='description' content='A BooleanToggle button determines whether an animated Cone is jittery or not.'/> |
7 | <meta name='creator' content='Leonard Daly and Don Brutzman'/> |
8 | <meta name='created' content='9 October 2006'/> |
9 | <meta name='modified' content='28 April 2023'/> |
10 | <meta name=' TODO ' content=' BS Contact BitManagement Bug Report submitted 28 November 2014 http://www.bitmanagement.de/en/contact '/> |
11 | <meta name='reference' content='https://X3dGraphics.com'/> |
12 | <meta name='reference' content='https://www.web3d.org/x3d/content/examples/X3dResources.html'/> |
13 | <meta name='rights' content='Copyright 2006, Daly Realism and Don Brutzman'/> |
14 | <meta name='subject' content='X3D book, X3D graphics, X3D-Edit, http://www.x3dGraphics.com'/> |
15 | <meta name='identifier' content='https://www.web3d.org/x3d/content/examples/X3dForWebAuthors/Chapter09EventUtilitiesScripting/BooleanToggleExample.x3d'/> |
16 | <meta name='generator' content='X3D-Edit 3.3, https://savage.nps.edu/X3D-Edit'/> |
17 | <meta name='license' content='../license.html'/> |
18 | </head> |
19 | <Scene> |
20 | <WorldInfo title='Boolean Toggle Example'/> |
21 | <Viewpoint description='Select red button to toggle cone jitter'/> |
22 | <Transform rotation='1 0 0 1.57'> |
23 | <Shape> |
24 | <Appearance> |
25 | <Material diffuseColor='1 0 0'/> |
26 | </Appearance> |
27 | <Cylinder height='.5' radius='.5'/> |
28 | </Shape> |
29 |
<!-- ROUTE information for TouchButton node:
[from isActive to Toggler.set_boolean
]
-->
<TouchSensor DEF='TouchButton' description='touch to activate'/> |
30 | </Transform> |
31 | <Transform translation='2 0 0'> |
32 |
<!-- ROUTE information for ShakingCone node:
[from Shaker.value_changed to translation
]
-->
<Transform DEF='ShakingCone'> |
33 | <Shape> |
34 | <Appearance> |
35 | <Material diffuseColor='0 .8 0'/> |
36 | </Appearance> |
37 | <Cone/> |
38 | </Shape> |
39 | </Transform> |
40 | </Transform> |
41 |
<!-- ROUTE information for Toggler node:
[from TouchButton.isActive to set_boolean
]
[from toggle_changed to Tee.set_boolean
]
-->
<BooleanToggle DEF='Toggler' containerField='children'/> |
42 | < ROUTE fromNode='TouchButton' fromField='isActive' toNode='Toggler' toField='set_boolean'/> |
43 |
<!-- ROUTE information for Tee node:
[from Toggler.toggle_changed to set_boolean
]
[from inputTrue to PauseOn.set_boolean
]
[from inputFalse to PauseOff.set_boolean
]
-->
<BooleanFilter DEF='Tee'/> |
44 | < ROUTE fromNode='Toggler' fromField='toggle_changed' toNode='Tee' toField='set_boolean'/> |
45 |
<!-- ROUTE information for PauseOn node:
[from Tee.inputTrue to set_boolean
]
[from triggerTime to Timer.pauseTime
]
-->
<TimeTrigger DEF='PauseOn'/> |
46 | < ROUTE fromNode='Tee' fromField='inputTrue' toNode='PauseOn' toField='set_boolean'/> |
47 |
<!-- ROUTE information for PauseOff node:
[from Tee.inputFalse to set_boolean
]
[from triggerTime to Timer.resumeTime
]
-->
<TimeTrigger DEF='PauseOff'/> |
48 | < ROUTE fromNode='Tee' fromField='inputFalse' toNode='PauseOff' toField='set_boolean'/> |
49 |
<!-- ROUTE information for Timer node:
[from PauseOn.triggerTime to pauseTime
]
[from PauseOff.triggerTime to resumeTime
]
[from fraction_changed to Shaker.set_fraction
]
-->
<TimeSensor DEF='Timer' cycleInterval='.15' loop='true' startTime='1'/> |
50 | < ROUTE fromNode='PauseOn' fromField='triggerTime' toNode='Timer' toField='pauseTime'/> |
51 | < ROUTE fromNode='PauseOff' fromField='triggerTime' toNode='Timer' toField='resumeTime'/> |
52 |
<!-- ROUTE information for Shaker node:
[from Timer.fraction_changed to set_fraction
]
[from value_changed to ShakingCone.translation
]
-->
<PositionInterpolator DEF='Shaker' key='0 .25 .50 .75 1' keyValue='0 0 0 .4 .2 -.3 -.2 .3 .1 -.1 -.2 .3 0 0 0'/> |
53 | < ROUTE fromNode='Timer' fromField='fraction_changed' toNode='Shaker' toField='set_fraction'/> |
54 | < ROUTE fromNode='Shaker' fromField='value_changed' toNode='ShakingCone' toField='translation'/> |
55 | </Scene> |
56 | </X3D> |
Event Graph ROUTE Table entries with 8 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.
TouchButton
TouchSensor isActive SFBool |
Toggler
BooleanToggle set_boolean SFBool |
then
|
Toggler
BooleanToggle toggle_changed SFBool |
Tee
BooleanFilter set_boolean SFBool |
then
|
Tee
BooleanFilter inputFalse SFBool |
PauseOff
TimeTrigger set_boolean SFBool |
then
|
PauseOff
TimeTrigger triggerTime SFTime |
Timer
TimeSensor resumeTime SFTime |
then
|
Timer
TimeSensor fraction_changed SFFloat |
Shaker
PositionInterpolator set_fraction SFFloat |
then
|
Shaker
PositionInterpolator value_changed SFVec3f |
ShakingCone
Transform translation SFVec3f |
||||||
then
|
Tee
BooleanFilter inputTrue SFBool |
PauseOn
TimeTrigger set_boolean SFBool |
then
|
PauseOn
TimeTrigger triggerTime SFTime |
Timer
TimeSensor pauseTime SFTime |
then
|
Timer
TimeSensor fraction_changed SFFloat |
Shaker
PositionInterpolator set_fraction SFFloat |
then
|
Shaker
PositionInterpolator value_changed SFVec3f |
ShakingCone
Transform translation SFVec3f |
<!--
Color 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. -->