Web3D/VRML
[] readme course preface 1 2 3 4 5 6 7 reference examples resources

talk show tell print

x-switch.vr (wrl ) [ flux / bitmanagement / cortona / octaga ]

switch cycling

script


  
  DEF CYCLE Script {
     eventIn SFTime touchTime
     field SFInt32 number 4
     eventOut SFInt32 output
     url "javascript:
        function initialize() {
           output = 0;
        }
        function touchTime(value, time) {
           if (output == number - 1) output = 0;
           else ++output;
        }
     "
  }
  
  

button


  Transform {
     translation -7 5 0
     children [
        DEF SENSOR TouchSensor {
        }
        Shape {
           appearance Appearance {
              material Material {
                 emissiveColor 1 0 0
              }
           }
           geometry Sphere {
              radius 0.1
           }
        }
     ]
  }
  
  

switch


  
  DEF SWITCH Switch {
     whichChoice 0
     choice [
        Shape {
           appearance DEF BLUE Appearance {
              material Material {
                 diffuseColor 0 0 1
              }
           }
           geometry Box {}
        }
        Shape {
           appearance USE BLUE
           geometry Sphere {}
        }
        Shape {
           appearance USE BLUE
           geometry Cone {}
        }
        Shape {
           appearance USE BLUE
           geometry Cylinder {}
        }
     ]
  }
  
  

event routing


  
  ROUTE SENSOR.touchTime TO CYCLE.touchTime
  ROUTE CYCLE.output TO SWITCH.whichChoice
  


[] readme course preface 1 2 3 4 5 6 7 reference examples resources
eliens@cs.vu.nl

draft version 0.3 (17/9/2001)