<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE X3D PUBLIC "ISO//Web3D//DTD X3D 3.0//EN" "https://www.web3d.org/specifications/x3d-3.0.dtd">
<X3D profile='Immersive' version='3.0 xmlns:xsd='http://www.w3.org/2001/XMLSchema-instance' xsd:noNamespaceSchemaLocation =' https://www.web3d.org/specifications/x3d-3.0.xsd '>
<head>
<meta name='titlecontent='ColorSequencerExample.x3d'/>
<meta name='descriptioncontent='This example shows how to use the ColorSequencer prototype in an animated scenario. ColorSequencer outputs an individual SFColor without interpolation, in response to selecting an array value or simply sequencing next/previous.'/>
<meta name='creatorcontent='Don Brutzman'/>
<meta name='createdcontent='25 May 2003'/>
<meta name='modifiedcontent='28 November 2019'/>
<meta name='referencecontent=' https://www.web3d.org/technicalinfo/specifications/vrml97/part1/nodesRef.html#ScalarInterpolator '/>
<meta name='referencecontent=' https://www.web3d.org/x3d/content/examples/Basic/development/BooleanSequencerExample.x3d '/>
<meta name='referencecontent='ColorSequencerPrototype.x3d'/>
<meta name='subjectcontent='color sequencer'/>
<meta name='identifiercontent=' https://savage.nps.edu/Savage/Tools/Animation/ColorSequencerExample.x3d '/>
<meta name='generatorcontent='X3D-Edit 3.2, https://savage.nps.edu/X3D-Edit'/>
<meta name='licensecontent=' ../../license.html'/>
</head>
<!--

Index for ExternProtoDeclare definition : ColorSequencer

Index for DEF nodes : AppearanceTransparent, Clock, ColorSequencerInstance, MessageBackgroundMaterial, MessageMaterial, Ticker, Toggler, TogglerStop, TouchCycle, TouchNext, TouchPrevious

Index for Viewpoint image : Viewpoint_1
-->
<Scene>
<WorldInfo title='ColorSequencerExample.x3d'/>
<ExternProtoDeclare name='ColorSequencerappinfo='ColorSequencer outputs a single color value by selecting an array index or simply sequencing next/previous'
  url=' "../../../Savage/Tools/Animation/ColorSequencerPrototype.x3d#ColorSequencer" "https://savage.nps.edu/Savage/Tools/Animation/ColorSequencerPrototype.x3d#ColorSequencer" "../../../Savage/Tools/Animation/ColorSequencerPrototype.wrl#ColorSequencer" "https://savage.nps.edu/Savage/Tools/Animation/ColorSequencerPrototype.wrl#ColorSequencer" '>
<field name='enabledtype='SFBoolaccessType='inputOutput'
 appinfo='Whether or not this sequencer is active'/>

<field name='indextype='SFInt32accessType='inputOutput'
 appinfo='Initial index is array element 0. Setting index past colors[max] uses final color value setting, while index less than 0 uses colors[0] value.'/>

<field name='colorstype='MFColoraccessType='inputOutput'
 appinfo='Array of color values that are each the outputs of the sequencer. No interpolation occurs between values.'/>

<field name='color_changedtype='SFColoraccessType='outputOnly'
 appinfo='Current output color value of the sequencer corresponding to colors[index] value.'/>

<field name='previoustype='SFBoolaccessType='inputOnly'
 appinfo='Trigger previous color value. Wrap around from zeroth color to final color if necessary. Only respond to true inputs.'/>

<field name='nexttype='SFBoolaccessType='inputOnly'
 appinfo='Trigger next color value. Wrap around from final color to zeroth color if necessary. Only respond to true inputs.'/>

<field name='traceEnabledtype='SFBoolaccessType='initializeOnly'
 appinfo='Enable tracing of node operation on browser console'/>

<!-- <field accessType='inputOnly' appinfo='Change colors array' name='set_colors' type='MFColor'/> -->
<!-- <field accessType='inputOnly' appinfo='Change current colors index must be in range [0 .. colors.length-1]' name='set_index' type='SFInt32'/> -->
</ExternProtoDeclare>
<Viewpoint description='ColorSequencer demo'/>
<Background skyAngle='0.5 0.5 0.5skyColor='0.5 0.5 0.5'/>
<!-- ROUTE information for ColorSequencerInstance node:  [from TouchPrevious.isActive to previous ] [from TouchNext.isActive to next ] [from Ticker.value_changed to index ] [from color_changed to MessageMaterial.diffuseColor ] [from color_changed to MessageBackgroundMaterial.diffuseColor ] -->
<ProtoInstance name='ColorSequencerDEF='ColorSequencerInstance'>
<!-- ROY G BIV = red orange yellow green blue indigo violet -->
<fieldValue name='colorsvalue='1 0 0 1 0.5 0 1 1 0 0 1 0 0 0 1 0.2 0.2 0.2 0.4 0 0.4'/>
<fieldValue name='enabledvalue='true'/>
<fieldValue name='indexvalue='2'/>
<fieldValue name='traceEnabledvalue='true'/>
</ProtoInstance>
<Transform translation='0 1.5 0'>
<Shape>
<Text string='"ColorSequencer" "Example"'>
<FontStyle justify='"MIDDLE" "MIDDLE"size='1.3'/>
</Text>
<Appearance>
<!-- ROUTE information for MessageMaterial node:  [from ColorSequencerInstance.color_changed to diffuseColor ] -->
<Material DEF='MessageMaterialdiffuseColor='0 1 1'/>
</Appearance>
</Shape>
<Transform translation='0 -0.25 0'>
<Shape>
<Box size='10.0 4.0 0.1'/>
<Appearance>
<!-- ROUTE information for MessageBackgroundMaterial node:  [from ColorSequencerInstance.color_changed to diffuseColor ] -->
<Material DEF='MessageBackgroundMaterialtransparency='0.8'/>
</Appearance>
</Shape>
</Transform>
<ROUTE fromNode='ColorSequencerInstancefromField='color_changedtoNode='MessageMaterialtoField='diffuseColor'/>
<ROUTE fromNode='ColorSequencerInstancefromField='color_changedtoNode='MessageBackgroundMaterialtoField='diffuseColor'/>
</Transform>
<Transform translation='-2.4 -2 0'>
<Shape>
<Appearance>
<Material diffuseColor='1 0 0'/>
</Appearance>
<Text string='"previous"'>
<FontStyle justify='"MIDDLE" "MIDDLE"style='BOLD'/>
</Text>
</Shape>
<!-- ROUTE information for TouchPrevious node:  [from isActive to ColorSequencerInstance.previous ] [from isActive to TogglerStop.set_boolean ] -->
<TouchSensor DEF='TouchPreviousdescription='Select this text to see previous color'/>
<ROUTE fromNode='TouchPreviousfromField='isActivetoNode='ColorSequencerInstancetoField='previous'/>
<Shape>
<Box size='3.4 0.8 0.1'/>
<Appearance DEF='AppearanceTransparent'>
<Material transparency='1'/>
</Appearance>
</Shape>
</Transform>
<Transform translation='0.8 -2 0'>
<Shape>
<Appearance>
<Material diffuseColor='1 1 0'/>
</Appearance>
<Text string='"cycle"'>
<FontStyle justify='"MIDDLE" "MIDDLE"'/>
</Text>
</Shape>
<Shape>
<Box size='2 0.8 0.1'/>
<Appearance USE='AppearanceTransparent'/>
</Shape>
<!-- ROUTE information for TouchCycle node:  [from isActive to Toggler.set_boolean ] -->
<TouchSensor DEF='TouchCycledescription='Select this text to cycle through all colors'/>
</Transform>
<Transform translation='3.2 -2 0'>
<Shape>
<Appearance>
<Material diffuseColor='0 1 0'/>
</Appearance>
<Text string='"next"'>
<FontStyle justify='"MIDDLE" "MIDDLE"'/>
</Text>
</Shape>
<Shape>
<Box size='1.8 0.8 0.1'/>
<Appearance USE='AppearanceTransparent'/>
</Shape>
<!-- ROUTE information for TouchNext node:  [from isActive to ColorSequencerInstance.next ] [from isActive to TogglerStop.set_boolean ] -->
<TouchSensor DEF='TouchNextdescription='Select this text to see next color'/>
<ROUTE fromNode='TouchNextfromField='isActivetoNode='ColorSequencerInstancetoField='next'/>
</Transform>
<!-- cycle toggler logic -->
<!-- ROUTE information for Ticker node:  [from Clock.fraction_changed to set_fraction ] [from value_changed to ColorSequencerInstance.index ] -->
<IntegerSequencer DEF='Tickerkey='0 0.125 0.25 0.375 0.5 0.625 0.75keyValue='0 1 2 3 4 5 6containerField='children'/>
<!-- ROUTE information for Clock node:  [from Toggler.toggle_changed to enabled ] [from fraction_changed to Ticker.set_fraction ] -->
<TimeSensor DEF='ClockcycleInterval='8enabled='falseloop='true'/>
<!-- ROUTE information for Toggler node:  [from TouchCycle.isActive to set_boolean ] [from TogglerStop.inputFalse to toggle ] [from toggle_changed to Clock.enabled ] -->
<BooleanToggle DEF='TogglercontainerField='children'/>
<ROUTE fromNode='TickerfromField='value_changedtoNode='ColorSequencerInstancetoField='index'/>
<ROUTE fromNode='ClockfromField='fraction_changedtoNode='TickertoField='set_fraction'/>
<ROUTE fromNode='TogglerfromField='toggle_changedtoNode='ClocktoField='enabled'/>
<ROUTE fromNode='TouchCyclefromField='isActivetoNode='TogglertoField='set_boolean'/>
<!-- Ensure that next, previous selection events also turn off the color cycle -->
<!-- ROUTE information for TogglerStop node:  [from TouchPrevious.isActive to set_boolean ] [from TouchNext.isActive to set_boolean ] [from inputFalse to Toggler.toggle ] -->
<BooleanFilter DEF='TogglerStopcontainerField='children'/>
<ROUTE fromNode='TogglerStopfromField='inputFalsetoNode='TogglertoField='toggle'/>
<ROUTE fromNode='TouchPreviousfromField='isActivetoNode='TogglerStoptoField='set_boolean'/>
<ROUTE fromNode='TouchNextfromField='isActivetoNode='TogglerStoptoField='set_boolean'/>
</Scene>
</X3D>
<!--

Index for ExternProtoDeclare definition : ColorSequencer

Index for DEF nodes : AppearanceTransparent, Clock, ColorSequencerInstance, MessageBackgroundMaterial, MessageMaterial, Ticker, Toggler, TogglerStop, TouchCycle, TouchNext, TouchPrevious

Index for Viewpoint image : Viewpoint_1
-->

<!-- Color key: <X3dNode DEF='idName' field='value'/> matches <XmlElement DEF='idName' attribute='value'/>
(Light blue background: behavior node) (Grey background: inserted documentation) (Magenta background: X3D Extensibility)
    <Prototype name='ProtoName'> <field name='fieldName'/> </Prototype> -->

<!-- For additional help information about X3D scenes, please see X3D Tooltips, X3D Resources and X3D Scene Authoring Hints. -->