sliderLoop_0_00.x3d source
<?xml version="1.0" encoding="UTF-8"?>

<X3D>
<Scene>
<Viewpoint/>
<NavigationInfo
type='"EXAMINE"'
/>

<!-- 赤円錐 -->
<Transform DEF='Cone-Tf'>
<Transform translation='3 0 0'>
<Shape>
<Appearance>
<Material diffuseColor='1 0 0'/>
</Appearance>
<Cone height='0.5' bottomRadius='0.2'/>
</Shape>
</Transform>
</Transform>

<!-- スライダー -->
<Group>
<Transform DEF='Slider-Tf' translation='1 0 0'>
<Shape>
<Appearance>
<Material diffuseColor='0 0.8 0'/>
</Appearance>
<Sphere radius='0.2'/>
</Shape>
</Transform>
<Shape>
<Appearance>
<Material diffuseColor='0.5 0 0'/>
</Appearance>
<Box size='2 0.1 0.1'/>
</Shape>
<PlaneSensor DEF='Slider-PlS' minPosition='-0.99 0' maxPosition='1 0' offset='1 0 0'/>
<TouchSensor DEF='Slider-ThS'/>
</Group>
<ROUTE fromNode='Slider-PlS' fromField='translation_changed' toNode='Slider-Tf' toField='translation'/>

<!-- タイムセンサー -->
<TimeSensor DEF='TiS' loop='TRUE' cycleInterval='5'/>

<!-- 回転アニメ -->
<OrientationInterpolator DEF='OI'
key='0 0.25 0.5 0.75 1'
keyValue='0 0 1 0
0 0 1 1.5708
0 0 1 3.1416
0 0 1 4.7124
0 0 1 6.2832
'
/>

<!-- スピード調整スクリプト -->
<Script DEF='Sc'>
<field accessType='inputOnly' type='SFVec3f' name='adjustSpeed'/>
<field accessType='inputOnly' type='SFBool' name='enableTimeSensor'/>
<field accessType='outputOnly' type='SFTime' name='cycleInterval'/>
<field accessType='outputOnly' type='SFBool' name='enabledTiS'/>
<![CDATA[ecmascript:

function adjustSpeed (vec) {

cycleInterval = 10 / ( vec.x + 1 );

}

function enableTimeSensor (active) {

enabledTiS = !active;

}
]]>
</Script>

<ROUTE fromNode='Slider-PlS' fromField='translation_changed' toNode='Sc' toField='adjustSpeed'/>
<ROUTE fromNode='Sc' fromField='cycleInterval' toNode='TiS' toField='cycleInterval'/>
<ROUTE fromNode='Slider-ThS' fromField='isActive' toNode='Sc' toField='enableTimeSensor'/>
<ROUTE fromNode='Sc' fromField='enabledTiS' toNode='TiS' toField='enabled'/>

<ROUTE fromNode='TiS' fromField='fraction_changed' toNode='OI' toField='set_fraction'/>
<ROUTE fromNode='OI' fromField='value_changed' toNode='Cone-Tf' toField='rotation'/>
</Scene>
</X3D>