Slider Controlled Light Intensity

#VRML V2.0 utf8

DirectionalLight { intensity .1 }
NavigationInfo { headlight FALSE type "EXAMINE" }
Background { skyColor 1 1 1 }
Viewpoint { position 0 -.5 4 }

Shape { 
   appearance DEF APP Appearance { material Material {} }
   geometry Sphere {}
}		

DEF LIGHT DirectionalLight { 
   direction 0 -1 -1 
   color 1 0 0
   intensity .5
}

Group {
   children [
      DEF MOVER Transform {
	 translation 0 -1.5 0
	 scale .2 .2 .2
	 children Shape {
	    appearance Appearance { 
	       material Material { diffuseColor 0 1 0 } 
	    }
	    geometry Box {}
	 }
      }

      DEF PS PlaneSensor {
	 maxPosition 1 -1.5
	 minPosition -1 -1.5
      }
   ]
}

DEF SCRIPT Script {
   eventIn SFVec3f translation
   eventOut SFFloat intensity
   url "vrmlscript:
function translation(val) {
   intensity = (val.x + 1)/2.0;
}"
}

ROUTE PS.translation_changed TO MOVER.translation
ROUTE PS.translation_changed TO SCRIPT.translation
ROUTE SCRIPT.intensity TO LIGHT.intensity



mrl