X3D Model Documentation: ColorSequencerExample.x3d

  1  <?xml version="1.0" encoding="UTF-8"?>
  2 
<!DOCTYPE X3D PUBLIC "ISO//Web3D//DTD X3D 3.0//EN" "https://www.web3d.org/specifications/x3d-3.0.dtd">
  3  <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'>
  4       <head>
  5            <meta name='titlecontent=' ColorSequencerExample.x3d '/>
  6            <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.'/>
  7            <meta name='creatorcontent='Don Brutzman'/>
  8            <meta name='createdcontent='25 May 2003'/>
  9            <meta name='modifiedcontent='28 November 2019'/>
 10            <meta name='referencecontent='https://www.web3d.org/technicalinfo/specifications/vrml97/part1/nodesRef.html#ScalarInterpolator'/>
 11            <meta name='referencecontent=' https://www.web3d.org/x3d/content/examples/Basic/development/BooleanSequencerExample.x3d '/>
 12            <meta name='referencecontent=' ColorSequencerPrototype.x3d '/>
 13            <meta name='subjectcontent='color sequencer'/>
 14            <meta name='identifiercontent=' https://www.web3d.org/x3d/content/examples/Savage/Tools/Animation/ColorSequencerExample.x3d '/>
 15            <meta name='generatorcontent='X3D-Edit 3.2, https://www.web3d.org/x3d/tools/X3D-Edit'/>
 16            <meta name='licensecontent='../../license.html'/>
 17       </head>
<!--

<!--
Event Graph ROUTE Table shows event connections.
-->
<!-- to top DEF nodes index: AppearanceTransparent, Clock, ColorSequencerInstance, MessageBackgroundMaterial, MessageMaterial, Ticker, Toggler, TogglerStop, TouchCycle, TouchNext, TouchPrevious

Index for Viewpoint node: Viewpoint_1

Index for ExternProtoDeclare definition: ColorSequencer
-->
 18       <Scene>
 19            <WorldInfo title='ColorSequencerExample.x3d'/>
 20            <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://www.web3d.org/x3d/content/examples/Savage/Tools/Animation/ColorSequencerPrototype.x3d#ColorSequencer" "../../../Savage/Tools/Animation/ColorSequencerPrototype.wrl#ColorSequencer" "https://www.web3d.org/x3d/content/examples/Savage/Tools/Animation/ColorSequencerPrototype.wrl#ColorSequencer" '>
 21                 <field name='enabledtype='SFBoolaccessType='inputOutput'
                appinfo='Whether or not this sequencer is active'/>
 22                 <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.'/>
 23                 <field name='colorstype='MFColoraccessType='inputOutput'
                appinfo='Array of color values that are each the outputs of the sequencer. No interpolation occurs between values.'/>
 24                 <field name='color_changedtype='SFColoraccessType='outputOnly'
                appinfo='Current output color value of the sequencer corresponding to colors[index] value.'/>
 25                 <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.'/>
 26                 <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.'/>
 27                 <field name='traceEnabledtype='SFBoolaccessType='initializeOnly'
                appinfo='Enable tracing of node operation on browser console'/>
 28                 <!-- <field accessType='inputOnly' appinfo='Change colors array' name='set_colors' type='MFColor'/> -->
 29                 <!-- <field accessType='inputOnly' appinfo='Change current colors index must be in range [0 .. colors.length-1]' name='set_index' type='SFInt32'/> -->
 30            </ExternProtoDeclare>
 31            <Viewpoint description='ColorSequencer demo'/>
 32            <Background skyAngle='0.5 0.5 0.5skyColor='0.5 0.5 0.5'/>
 33 
 34                 <!-- ROY G BIV = red orange yellow green blue indigo violet -->
 35                 <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'/>
 36                 <fieldValue name='enabledvalue='true'/>
 37                 <fieldValue name='indexvalue='2'/>
 38                 <fieldValue name='traceEnabledvalue='true'/>
 39            </ProtoInstance>
 40            <Transform translation='0 1.5 0'>
 41                 <Shape>
 42                      <Text string='"ColorSequencer" "Example"'>
 43                           <FontStyle justify='"MIDDLE" "MIDDLE"size='1.3'/>
 44                      </Text>
 45                      <Appearance>
 46 
                         <!-- ROUTE information for MessageMaterial node:  [from ColorSequencerInstance.color_changed to diffuseColor ] -->
                         <Material DEF='MessageMaterialdiffuseColor='0 1 1'/>
 47                      </Appearance>
 48                 </Shape>
 49                 <Transform translation='0 -0.25 0'>
 50                      <Shape>
 51                           <Box size='10.0 4.0 0.1'/>
 52                           <Appearance>
 53 
                              <!-- ROUTE information for MessageBackgroundMaterial node:  [from ColorSequencerInstance.color_changed to diffuseColor ] -->
                              <Material DEF='MessageBackgroundMaterialtransparency='0.8'/>
 54                           </Appearance>
 55                      </Shape>
 56                 </Transform>
 57                 < ROUTE  fromNode='ColorSequencerInstance' fromField='color_changed' toNode='MessageMaterial' toField='diffuseColor'/>
 58                 < ROUTE  fromNode='ColorSequencerInstance' fromField='color_changed' toNode='MessageBackgroundMaterial' toField='diffuseColor'/>
 59            </Transform>
 60            <Transform translation='-2.4 -2 0'>
 61                 <Shape>
 62                      <Appearance>
 63                           <Material diffuseColor='1 0 0'/>
 64                      </Appearance>
 65                      <Text string='"previous"'>
 66                           <FontStyle justify='"MIDDLE" "MIDDLE"style='BOLD'/>
 67                      </Text>
 68                 </Shape>
 69 
               <!-- 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'/>
 70                 < ROUTE  fromNode='TouchPrevious' fromField='isActive' toNode='ColorSequencerInstance' toField='previous'/>
 71                 <Shape>
 72                      <Box size='3.4 0.8 0.1'/>
 73 
                    <!-- Appearance AppearanceTransparent is a DEF node that has 2 USE nodes: USE_1, USE_2 -->
                    <Appearance DEF='AppearanceTransparent'>
 74                           <Material transparency='1'/>
 75                      </Appearance>
 76                 </Shape>
 77            </Transform>
 78            <Transform translation='0.8 -2 0'>
 79                 <Shape>
 80                      <Appearance>
 81                           <Material diffuseColor='1 1 0'/>
 82                      </Appearance>
 83                      <Text string='"cycle"'>
 84                           <FontStyle justify='"MIDDLE" "MIDDLE"'/>
 85                      </Text>
 86                 </Shape>
 87                 <Shape>
 88                      <Box size='2 0.8 0.1'/>
 89                      <Appearance USE='AppearanceTransparent'/>
 90                 </Shape>
 91 
               <!-- ROUTE information for TouchCycle node:  [from isActive to Toggler.set_boolean ] -->
               <TouchSensor DEF='TouchCycledescription='Select this text to cycle through all colors'/>
 92            </Transform>
 93            <Transform translation='3.2 -2 0'>
 94                 <Shape>
 95                      <Appearance>
 96                           <Material diffuseColor='0 1 0'/>
 97                      </Appearance>
 98                      <Text string='"next"'>
 99                           <FontStyle justify='"MIDDLE" "MIDDLE"'/>
100                      </Text>
101                 </Shape>
102                 <Shape>
103                      <Box size='1.8 0.8 0.1'/>
104                      <Appearance USE='AppearanceTransparent'/>
105                 </Shape>
106 
               <!-- 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'/>
107                 < ROUTE  fromNode='TouchNext' fromField='isActive' toNode='ColorSequencerInstance' toField='next'/>
108            </Transform>
109            <!-- cycle toggler logic -->
110 
          <!-- 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 6'/>
111 
          <!-- ROUTE information for Clock node:  [from Toggler.toggle_changed to enabled ] [from fraction_changed to Ticker.set_fraction ] -->
          <TimeSensor DEF='ClockcycleInterval='8enabled='falseloop='true'/>
112 
          <!-- 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'/>
113            < ROUTE  fromNode='Ticker' fromField='value_changed' toNode='ColorSequencerInstance' toField='index'/>
114            < ROUTE  fromNode='Clock' fromField='fraction_changed' toNode='Ticker' toField='set_fraction'/>
115            < ROUTE  fromNode='Toggler' fromField='toggle_changed' toNode='Clock' toField='enabled'/>
116            < ROUTE  fromNode='TouchCycle' fromField='isActive' toNode='Toggler' toField='set_boolean'/>
117            <!-- Ensure that next, previous selection events also turn off the color cycle -->
118 
          <!-- ROUTE information for TogglerStop node:  [from TouchPrevious.isActive to set_boolean ] [from TouchNext.isActive to set_boolean ] [from inputFalse to Toggler.toggle ] -->
          <BooleanFilter DEF='TogglerStop'/>
119            < ROUTE  fromNode='TogglerStop' fromField='inputFalse' toNode='Toggler' toField='toggle'/>
120            < ROUTE  fromNode='TouchPrevious' fromField='isActive' toNode='TogglerStop' toField='set_boolean'/>
121            < ROUTE  fromNode='TouchNext' fromField='isActive' toNode='TogglerStop' toField='set_boolean'/>
122       </Scene>
123  </X3D>
<!--

<!--
Event Graph ROUTE Table shows event connections.
-->
<!-- to top DEF nodes index: AppearanceTransparent, Clock, ColorSequencerInstance, MessageBackgroundMaterial, MessageMaterial, Ticker, Toggler, TogglerStop, TouchCycle, TouchNext, TouchPrevious

Index for Viewpoint node: Viewpoint_1

Index for ExternProtoDeclare definition: ColorSequencer
-->
X3D Tooltips element index: Appearance, Background, BooleanFilter, BooleanToggle, Box, ExternProtoDeclare, field, fieldValue, FontStyle, head, IntegerSequencer, Material, meta, ProtoInstance, ROUTE, Scene, Shape, Text, TimeSensor, TouchSensor, Transform, Viewpoint, WorldInfo, X3D, plus documentation for accessType definitions, type definitions, XML data types, and field types

Event Graph ROUTE Table entries with 11 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.

TouchCycle
TouchSensor
isActive
SFBool

ROUTE
event to
(1)
Toggler
BooleanToggle
set_boolean
SFBool
then
 
 
 
Toggler
BooleanToggle
toggle_changed
SFBool

ROUTE
event to
(2)
Clock
TimeSensor
enabled
SFBool
then
 
 
 
Clock
TimeSensor
fraction_changed
SFFloat

ROUTE
event to
(3)
Ticker
IntegerSequencer
set_fraction
SFFloat
then
 
 
 
Ticker
IntegerSequencer
value_changed
SFInt32

ROUTE
event to
(4)
ColorSequencerInstance
ProtoInstance
index
SFInt32
then
 
 
 
ColorSequencerInstance
ProtoInstance
color_changed
SFColor

ROUTE
event to
(5)
MessageMaterial
Material
diffuseColor
SFColor
  then
 
 
 
ColorSequencerInstance
ProtoInstance
color_changed
SFColor

ROUTE
event to
(5)
MessageBackgroundMaterial
Material
diffuseColor
SFColor

TouchNext
TouchSensor
isActive
SFBool

ROUTE
event to
(1)
ColorSequencerInstance
ProtoInstance
next
SFBool
then
 
 
 
ColorSequencerInstance
ProtoInstance
color_changed
SFColor

ROUTE
event to
(2)
MessageMaterial
Material
diffuseColor
SFColor
  then
 
 
 
ColorSequencerInstance
ProtoInstance
color_changed
SFColor

ROUTE
event to
(2)
MessageBackgroundMaterial
Material
diffuseColor
SFColor
TouchNext
TouchSensor
isActive
SFBool

ROUTE
event to
(1)
TogglerStop
BooleanFilter
set_boolean
SFBool
then
 
 
 
TogglerStop
BooleanFilter
inputFalse
SFBool

ROUTE
event to
(2)
Toggler
BooleanToggle
toggle
SFBool
then
 
 
 
Toggler
BooleanToggle
toggle_changed
SFBool

ROUTE
event to
(3)
Clock
TimeSensor
enabled
SFBool
then
 
 
 
Clock
TimeSensor
fraction_changed
SFFloat

ROUTE
event to
(4)
Ticker
IntegerSequencer
set_fraction
SFFloat
then
 
 
 
Ticker
IntegerSequencer
value_changed
SFInt32

ROUTE
event to
(5)
ColorSequencerInstance
ProtoInstance
index
SFInt32
then
 
 
 
ColorSequencerInstance
ProtoInstance
color_changed
SFColor

ROUTE
event to
(6)
MessageMaterial
Material
diffuseColor
SFColor
  then
 
 
 
ColorSequencerInstance
ProtoInstance
color_changed
SFColor

ROUTE
event to
(6)
MessageBackgroundMaterial
Material
diffuseColor
SFColor

TouchPrevious
TouchSensor
isActive
SFBool

ROUTE
event to
(1)
ColorSequencerInstance
ProtoInstance
previous
SFBool
then
 
 
 
ColorSequencerInstance
ProtoInstance
color_changed
SFColor

ROUTE
event to
(2)
MessageMaterial
Material
diffuseColor
SFColor
  then
 
 
 
ColorSequencerInstance
ProtoInstance
color_changed
SFColor

ROUTE
event to
(2)
MessageBackgroundMaterial
Material
diffuseColor
SFColor
TouchPrevious
TouchSensor
isActive
SFBool

ROUTE
event to
(1)
TogglerStop
BooleanFilter
set_boolean
SFBool
then
 
 
 
TogglerStop
BooleanFilter
inputFalse
SFBool

ROUTE
event to
(2)
Toggler
BooleanToggle
toggle
SFBool
then
 
 
 
Toggler
BooleanToggle
toggle_changed
SFBool

ROUTE
event to
(3)
Clock
TimeSensor
enabled
SFBool
then
 
 
 
Clock
TimeSensor
fraction_changed
SFFloat

ROUTE
event to
(4)
Ticker
IntegerSequencer
set_fraction
SFFloat
then
 
 
 
Ticker
IntegerSequencer
value_changed
SFInt32

ROUTE
event to
(5)
ColorSequencerInstance
ProtoInstance
index
SFInt32
then
 
 
 
ColorSequencerInstance
ProtoInstance
color_changed
SFColor

ROUTE
event to
(6)
MessageMaterial
Material
diffuseColor
SFColor
  then
 
 
 
ColorSequencerInstance
ProtoInstance
color_changed
SFColor

ROUTE
event to
(6)
MessageBackgroundMaterial
Material
diffuseColor
SFColor

      ColorSequencerInstance
ProtoInstance
color_changed
SFColor

ROUTE
event to
(1)
MessageMaterial
Material
diffuseColor
SFColor
ColorSequencerInstance
ProtoInstance
color_changed
SFColor

ROUTE
event to
(1)
MessageBackgroundMaterial
Material
diffuseColor
SFColor

Additional guidance on X3D animation can be found in the 10-Step Animation Design Process and Event Tracing hint sheets. Have fun with X3D! 😀

-->
<!-- Online at
https://www.web3d.org/x3d/content/examples/Savage/Tools/Animation/ColorSequencerExampleIndex.html -->
<!-- Version control at
https://sourceforge.net/p/x3d/code/HEAD/tree/www.web3d.org/x3d/content/examples/Savage/Tools/Animation/ColorSequencerExample.x3d -->

<!-- Color-coding legend: X3D terminology <X3dNode  DEF='idNamefield='value'/> matches XML terminology <XmlElement  DEF='idNameattribute='value'/>
(Light-blue background: event-based behavior node or statement) (Grey background inside box: inserted documentation) (Magenta background: X3D Extensibility)
    <ProtoInstance name='ProtoName'> <field name='fieldName'/> </ProtoInstance> -->

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