#VRML V2.0 utf8 WorldInfo {title "LowpolyText PROTO Sample 5"} #Ver1.2 NavigationInfo {headlight TRUE type ["EXAMINE""ANY"]} Viewpoint { orientation 0 -1 0 0.7477 position -2.7193 0.3332 2.2193 description "view 1" } EXTERNPROTO LowpolyText [ exposedField SFFloat distance exposedField SFFloat italic exposedField SFFloat spacing exposedField SFRotation rotation exposedField SFVec3f scale exposedField MFString string field SFBool solid field MFString justify ] "lowpolytext.wrl" DEF TS TouchSensor {} Shape { appearance Appearance { material Material { diffuseColor 0 0 0.001 emissiveColor 0 1 0 } } geometry DEF lpt LowpolyText { italic 0.2 distance 0 string "Hello!" justify "MIDDLE" } } DEF TIMER TimeSensor {cycleInterval 2} DEF SC Script { eventIn SFBool TSisActive eventIn SFFloat fractionIn eventOut SFTime startTime eventOut SFFloat fractionOut field SFNode TIMER USE TIMER field SFBool widened FALSE url "javascript: function TSisActive(touched,time) { if (touched) { if (!TIMER.isActive) { widened=!widened; startTime=time; } } } function fractionIn(val) { if (widened) fractionOut=val; else fractionOut=1-val; }" } ROUTE TS.isActive TO SC.TSisActive ROUTE SC.startTime TO TIMER.startTime ROUTE TIMER.fraction_changed TO SC.fractionIn ROUTE SC.fractionOut TO lpt.set_distance