<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE X3D PUBLIC "ISO//Web3D//DTD X3D 3.1//EN"   "http://www.web3d.org/specifications/x3d-3.1.dtd">
<X3D profile='Immersiveversion='3.1xmlns:xsd='http://www.w3.org/2001/XMLSchema-instance' xsd:noNamespaceSchemaLocation=' http://www.web3d.org/specifications/x3d-3.1.xsd '>
<head>
<meta name='titlecontent='ScriptComplexStateEvents.x3d'/>
<meta name='descriptioncontent='Complex Script events.'/>
<meta name='creatorcontent='Leonard Daly and Don Brutzman'/>
<meta name='createdcontent='8 April 2006'/>
<meta name='modifiedcontent='8 October 2007'/>
<meta name='referencecontent=' http://X3dGraphics.com '/>
<meta name='referencecontent=' http://www.web3d.org/x3d/content/examples/help.html '/>
<meta name='rightscontent='Copyright 2006, Daly Realism and Don Brutzman'/>
<meta name='subjectcontent=' X3D book, X3D graphics, X3D-Edit, http://www.x3dGraphics.com '/>
<meta name='identifiercontent=' http://X3dGraphics.com/examples/X3dForWebAuthors/Chapter11-LightingEnvironment/ScriptComplexStateEvents.x3d '/>
<meta name='generatorcontent='X3D-Edit, https://savage.nps.edu/X3D-Edit'/>
<meta name='licensecontent='../license.html'/>
</head>
<!--

Index for DEF nodes: Base, Bulb, Button, ButtonMover, ButtonTimer, ButtonTouch, Control, ControlBox, ControlButton, Lamp, lightBulb, LightSource, PushBox
Index for Viewpoint images: Viewpoint_1, Viewpoint_2
-->
<Scene>
<Background skyColor='1 1 1'/>
<Viewpoint description='Default Viewpoint'/>
<Viewpoint description='Book Viewpointorientation='-0.998 0.055 -0.036 1.052position='0.66 8.82 5.27'/>
<!-- LightSource ROUTE:  [from Control.lightColor to color ] -->
<PointLight DEF='LightSourcecolor='.4 .4 .4location='1 0 0global='true'/>
<Transform DEF='PushBoxtranslation='-2 0 0'>
<Transform DEF='ControlBox'>
<Shape>
<Appearance>
<Material diffuseColor='0 .8 0'/>
</Appearance>
<Box size='1 .5 1'/>
</Shape>
</Transform>
<!-- ControlButton ROUTE:  [from ButtonMover.value_changed to translation ] -->
<Transform DEF='ControlButtontranslation='0 .25 0'>
<!-- ButtonTouch ROUTE:  [from touchTime to ButtonTimer.startTime ] -->
<TouchSensor DEF='ButtonTouchdescription='touch to activate'/>
<Shape>
<Appearance>
<Material diffuseColor='1 0 0'/>
</Appearance>
<Cylinder DEF='Buttonbottom='falseheight='.5radius='.25'/>
</Shape>
<!-- ButtonTimer ROUTEs:  [from ButtonTouch.touchTime to startTime ] [from fraction_changed to ButtonMover.set_fraction ] [from isActive to Control.buttonMotionDone ] -->
<TimeSensor DEF='ButtonTimercycleInterval='.3stopTime='1'/>
<!-- ButtonMover ROUTEs:  [from ButtonTimer.fraction_changed to set_fraction ] [from value_changed to ControlButton.translation ] -->
<PositionInterpolator DEF='ButtonMoverkey='0 .5 1keyValue='0 .25 0 0 .05 0 0 .25 0'/>
<ROUTE fromNode='ButtonTouchfromField='touchTimetoNode='ButtonTimertoField='startTime'/>
<ROUTE fromNode='ButtonTimerfromField='fraction_changedtoNode='ButtonMovertoField='set_fraction'/>
<ROUTE fromNode='ButtonMoverfromField='value_changedtoNode='ControlButtontoField='translation'/>
</Transform>
</Transform>
<Transform DEF='Lamptranslation='1 0 0'>
<Transform DEF='Base'>
<Shape>
<Appearance>
<Material/>
</Appearance>
<Cylinder height='.5radius='.25'/>
</Shape>
</Transform>
<Transform DEF='Bulbtranslation='0 .5 0'>
<Shape>
<Appearance>
<!-- lightBulb ROUTE:  [from Control.lightColor to diffuseColor ] -->
<Material DEF='lightBulbdiffuseColor='.4 .4 .4'/>
</Appearance>
<Sphere radius='.5'/>
</Shape>
</Transform>
</Transform>
<!-- Control ROUTEs:  [from ButtonTimer.isActive to buttonMotionDone ] [from lightColor to lightBulb.diffuseColor ] [from lightColor to LightSource.color ] -->
<Script DEF='Control'
  url=' "ScriptComplexStateEvents.js" "http://X3dGraphics.com/examples/X3dForWebAuthors/Chapter11-LightingEnvironment/ScriptComplexStateEvents.js" '>
<field name='buttonMotionDonetype='SFBoolaccessType='inputOnly'/>
<field name='buttonDowntype='SFInt32value='0accessType='initializeOnly'/>
<field name='lightColortype='SFColoraccessType='outputOnly'/>
</Script>
<ROUTE fromNode='ButtonTimerfromField='isActivetoNode='ControltoField='buttonMotionDone'/>
<ROUTE fromNode='ControlfromField='lightColortoNode='lightBulbtoField='diffuseColor'/>
<ROUTE fromNode='ControlfromField='lightColortoNode='LightSourcetoField='color'/>
</Scene>
</X3D>
<!--

Index for DEF nodes: Base, Bulb, Button, ButtonMover, ButtonTimer, ButtonTouch, Control, ControlBox, ControlButton, Lamp, lightBulb, LightSource, PushBox
Index for Viewpoint images: Viewpoint_1, Viewpoint_2
-->

<!-- Tag color codes: <Node DEF='idName' attribute='value'/> -->