InitialObjectDescriptor { objectDescriptorID 1 audioProfileLevelIndication 255 visualProfileLevelIndication 254 sceneProfileLevelIndication 1 graphicsProfileLevelIndication 1 ODProfileLevelIndication 1 esDescr [ ES_Descriptor { ES_ID 1 decConfigDescr DecoderConfigDescriptor { streamType 3 decSpecificInfo BIFSConfig { isCommandStream true pixelMetric true pixelWidth 600 pixelHeight 400 } } } ] } OrderedGroup { children [ Background2D { backColor 1 1 1 } WorldInfo { info ["This shows script Initialize usage" "" "GPAC Regression Tests" "(C) 2002-2004 GPAC Team"] title "Script initialize test" } Shape { appearance Appearance { material DEF MAT Material2D { emissiveColor 1 0 0 filled TRUE } } geometry DEF IFS IndexedFaceSet2D { colorPerVertex FALSE coordIndex [0 1 2 3 4 5] coord Coordinate2D { point [-120 0 -50 100 50 100 120 0 50 -100 -50 -100] } } } Transform2D { translation -150 -120 children [ Shape { appearance Appearance { material Material2D { emissiveColor 0 0 0 filled TRUE } } geometry DEF TEXT Text { string [""] fontStyle FontStyle { family ["SANS"] justify ["BEGIN" "BEGIN"] size 20 } } } ] } DEF TS TimeSensor { cycleInterval 0.2 loop TRUE } DEF SCRIPT Script { eventIn SFTime act field SFInt32 count 0 eventOut SFFloat transp eventOut MFString txt url ["javascript: function initialize(value, timestamp) {my_global_string = 'global int = ';my_global_int = 10;}function act(value, timestamp) {count++;if (count>= 20) count = 0;transp = count / 20;txt[0] = 'transparency: ' + transp; txt[1] = my_global_string + my_global_int; }" ] } ] } ROUTE TS.cycleTime TO SCRIPT.act ROUTE SCRIPT.transp TO MAT.transparency ROUTE SCRIPT.txt TO TEXT.string