media @ VU
[] readme course preface I 1 2 II 3 4 III 5 6 7 IV 8 9 10 V 11 12 afterthoughts appendix references examples resources _

talk show tell print

proto-slide-vcr.vr

proto-slide-vcr.vr (wrl ) [ flux / bitmanagement / cortona / octaga ]


  PROTO slide-vcr [
  exposedField SFTime startTime 0
  exposedField SFTime stopTime 0
  exposedField MFString video []
  exposedField SFFloat loudness 1
  exposedField SFVec3f translation 0 0 0
  exposedField SFVec3f scale 1 1 1
  exposedField SFRotation rotation 0 1 0 0
  exposedField SFVec3f size 1 1 0.1
  ]{
  Transform {
  translation IS translation
  scale IS scale
  rotation IS rotation
  children [
  DEF root Transform {
  scale 1 1 1
  children [
  Shape {
  appearance Appearance {
  material Material { diffuseColor 1 1 1 }
  texture DEF movie MovieTexture { 
  startTime IS startTime
  stopTime IS stopTime
  loop TRUE
  url IS video
  }
  }
  geometry Box { size IS size }
  }
  DEF sound Sound { source USE movie intensity IS loudness }
  Transform {
  translation 0 0 0.2
  children [
  DEF touch TouchSensor {}
  Shape {
  appearance Appearance {
      material Material {
        diffuseColor 1 0 0
        transparency 1
        }
  }
  geometry Box { size IS size }
  
  }
  DEF script Script {
  directOutput TRUE
  eventIn SFTime touch
  field SFNode movie USE movie 
  field SFNode sound USE sound
  field SFInt32 state 0
  field SFVec3f size IS size
  field SFBool on TRUE
  url "javascript:
  function initialize() {
  // root.scale = new SFVecf(size.x,size.y,size.z);
  }
  function touch(value) {
  print('state = ' + state);
  if (state == -1) {
  } else if (state == 0)  {
          movie.startTime = value;
          movie.stopTime = 0;
          sound.intensity = 1;
          on = TRUE;
          state = 1;
  } else if (state == 1) {
          movie.stopTime = value;
          on = FALSE;
          state = 0;
  } else if (state == 3) {
          sound.intensity = 0;
          state = 1;
  } }
  "
  }
  ROUTE touch.touchTime TO script.touch  ## initially forgotten!
  
  ] }
  
  ] } ## root
  ] }
  }
  


(C) A. Eliëns 21/5/2007

You may not copy or print any of this material without explicit permission of the author or the publisher.
In case of other copyright issues, contact the author.