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

talk show tell print

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

bouncing ball (1)

object


  
  DEF OBJECT Transform {
  scale 0.5 0.5 0.5
  children [ 
  Shape  {
          geometry Sphere { radius 2 }
          appearance Appearance {
                  material DEF MATERIAL Material {
                          diffuseColor 1 0 0
                          }
                  }
  }
  ] }
  
  

sensor


  DEF TIME TimeSensor { loop TRUE cycleInterval 5 } #<l++>
  
  

script


  DEF SCRIPT Script {   
          directOutput TRUE
          field SFNode object USE OBJECT
          field SFNode material USE MATERIAL
          field SFFloat position 0
          field SFFloat color 0.5
          eventIn SFFloat set_fraction    
          url "javascript:
  

fraction


          function set_fraction(value) {  
                  if (value < 0.5) {
                          position += 0.1;
                          color = value;
                  } else {
                          position -= 0.1;
                          color = value;
                          }
                  object.translation.y = position;
                  material.diffuseColor = new SFColor(color,color,1);
                  }
                  "
          }#<l++>
  
  ROUTE TIME.fraction_changed TO SCRIPT.set_fraction
  
  

environment


  
  Viewpoint { position 0 0 20 }
  Background { skyColor 0.4 0.2 0.2 }
  
  


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

draft version 0.3 (17/9/2001)