InitialObjectDescriptor {
 objectDescriptorID 1
 audioProfileLevelIndication 1
 visualProfileLevelIndication 1
 sceneProfileLevelIndication 1
 graphicsProfileLevelIndication 1
 ODProfileLevelIndication 1
 esDescr [
  ES_Descriptor {
   ES_ID 2
   decConfigDescr DecoderConfigDescriptor {
    streamType 3
    decSpecificInfo BIFSConfig {
     isCommandStream true
     pixelMetric true
     pixelWidth 500
     pixelHeight 200
    }
   }
  }
 ]
}

OrderedGroup {
 children [
  Background2D {
   backColor 1 1 1
  }
  WorldInfo {
   info [
    "This test shows how to fill object with linear gradients." 
    "Here the start and end point of the gradient are close"
    "You can click on the rectangle to move the start and the end of gradient." 
    "You can also drag it." 
    "" 
    "GPAC Regression Tests" "$Date: 2007-07-27 09:46:08 $ - $Revision: 1.3 $" 
    "(C) 2002-2006 GPAC Team"
   ]
   title "Linear Gradient"
  }
  Transform2D {
   children [
    Shape {
     appearance Appearance {
      material Material2D {
       lineProps LineProperties {
        width 0
       }
      }
      texture DEF GL LinearGradient {
       key [0 0.45 0.5 0.55 1]
       keyValue [0.2118 0.447 0.039 0.2118 0.447 0.039 0.2627 0.933 0 0.2392 0.3098 0.04313 0.2392 0.3098 0.04313]
       startPoint -1 0
      }
     }
     geometry DEF R Rectangle {
      size 400 20
     }
    }
    DEF TS TouchSensor {}
   ]
  }
  DEF SC Script {
   eventIn SFVec3f set_frac
   eventIn SFBool set_down
   field SFNode grad USE GL
   field SFBool isDown FALSE
   url ["javascript:function set_down(value, timestamp) {isDown = value;}function set_frac(value, timestamp) {if (!isDown) return;pos = (value.x + 200)/400;grad.startPoint.x = pos - 1;grad.endPoint.x = 1 + pos;print('pos ' + pos);}"   ]
  }
 ]
}

ROUTE TS.isActive TO SC.set_down
ROUTE TS.hitPoint_changed TO SC.set_frac

