<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE X3D PUBLIC "ISO//Web3D//DTD X3D 3.2//EN" "https://www.web3d.org/specifications/x3d-3.2.dtd">
<![CDATA[
ecmascript: function initialize() { positionSmo1= position; positionSmo2= position; positionSmo3= position; min= EFFS.min; max= EFFS.max; pageSize= EFFS.pageSize; height= EFFS.height; radiusKnob= EFFS.radiusKnob; radiusStick= EFFS.radiusStick; smoothMovements= EFFS.smoothMovements; // work around the initialization bug in Contact 5. if( Browser.getName() == 'blaxxunCC3D' && Browser.getVersion() <= 5.104 && !position && !min && !max && !pageSize && !height && !radiusKnob && !radiusStick ) { position= .5; min= 0; max= 1; pageSize= .2; height= 2; radiusKnob= .3; radiusStick= .2; positionSmo1= positionSmo2= positionSmo3= position; } Update(); Timer.enabled= true; // TBD: Shouldn't we start with false? } function set_min(m) { min= m; Update(); } function set_max(m) { max= m; Update(); } function set_pageSize(s) { pageSize= s; Update(); } function set_height(h) { height= h; UpdateGeometry(); } function set_radiusKnob(r) { radiusKnob= r; UpdateGeometry(); } function set_radiusStick(r) { radiusStick= r; UpdateGeometry(); } function set_position(p) { silent= false; snapTime= 0; position= snapToInt? Math.floor(p + .5) : p; Update(); } function set_smooothMovements(s) { smoothMovements= s; Update(); } function silently_set_position(p) { silent= true; snapTime= 0; position= snapToInt? Math.floor(p + .5) : p; Update(); } function silently_set_unfiltered_position(p, now) { silent= true; snapTime= 0; position= positionSmo1= positionSmo2= positionSmo3= p; snapTime= now + .1; Update(); } function set_unfiltered_position(p, now) { snapTime= 0; position= positionSmo1= positionSmo2= positionSmo3= p; snapTime= now + .1; Update(); } function incPage(t, now) { silent= false; position+= pageSize; snapTime= now + .3; Update(); } function decPage(t, now) { silent= false; position-= pageSize; snapTime= now + .3; Update(); } function SensKnob_isActive(a, now) { if(a) { SensKnobOrigin= smoothMovements? positionSmo3 : position; // TBD: Da stimmt noch was nicht. SmoothTau1= .07; SmoothTau2= .001; SmoothTau3= .001; // last_SensKnob_translationChange= SensKnob_translationChanged; }else{ SmoothTau1= .06; SmoothTau2= .06; SmoothTau3= .06; snapTime= now; } } function SensKnob_translationChanged(t, now) { silent= false; // if(t.subtract(last_SensKnob_translationChange).length() > .0001 ) // { position= SensKnobOrigin + ( height? t.y * (max - min) / (height - KnobSize) : 0 ); // snapTime= now + .3; // last_SensKnob_translationChange= t; // } Update(); } function Update() { UpdateLogic(); UpdateGeometry(); if(smoothMovements) { setUPC(position); }else{ setUPC(position); positionSmo1= position; positionSmo2= position; positionSmo3= position; setPC(position); } } function UpdateLogic() { if(max < min) max= min; if(position > max) position= max; if(positionSmo1 > max) positionSmo1= max; if(positionSmo2 > max) positionSmo2= max; if(positionSmo3 > max) positionSmo3= max; if(position < min) position= min; if(positionSmo1 < min) positionSmo1= min; if(positionSmo2 < min) positionSmo2= min; if(positionSmo3 < min) positionSmo3= min; } function UpdateGeometry() { KnobSize= max - min? pageSize / (max - min) * height : height ; KnobCenterPos= max - min? ( ( smoothMovements? positionSmo3 : position ) - (max + min)/2 ) / (max - min) * (height - KnobSize) : 0 ; TrKnob.scale= new SFVec3f(radiusKnob, KnobSize, radiusKnob); TrKnob.translation= new SFVec3f(0, KnobCenterPos, 0); TrStickAbove.scale= new SFVec3f(radiusStick, (height/2 - KnobCenterPos), radiusStick); TrStickAbove.translation= new SFVec3f(0, (height/2 + KnobCenterPos)/2, 0 ); TrStickBelow.scale= new SFVec3f(radiusStick, (KnobCenterPos - -height/2), radiusStick); TrStickBelow.translation= new SFVec3f(0, (KnobCenterPos + -height/2)/2, 0 ); } function Tick(now) { if(!lastTick) { lastTick= now; return; } var Delta= now - lastTick; if(smoothMovements) // TBD: The timer should be completely off if !Smoothmovements. { positionSmo1= position + (positionSmo1 - position ) * Math.exp(-Delta/SmoothTau1); positionSmo2= positionSmo1 + (positionSmo2 - positionSmo1) * Math.exp(-Delta/SmoothTau2); positionSmo3= positionSmo2 + (positionSmo3 - positionSmo2) * Math.exp(-Delta/SmoothTau3); UpdateGeometry(); setPC(positionSmo3); } if(snapToInt) if(snapTime && now >= snapTime) { var newPos= Math.floor(position + .5); SensKnobOrigin+= newPos - position; position= newPos; snapTime= 0; } //TBD: Set Timer.enabled lastTick= now; } function setUPC(value) { if(unfiltered_position_changed != value || initialUnfilteredUpdate) if(!silent) unfiltered_position_changed= value; initialUnfilteredUpdate= false; } function setPC(value) { if(position_changed != value || initialUpdate) if(!silent) position_changed= value; if(Math.floor(position_changed + .5) != positionInt_changed || initialUpdate) if(!silent) positionInt_changed= Math.floor(position_changed + .5); initialUpdate= false; }
]]>
Event Graph ROUTE Table with 0 ROUTE total, showing X3D event-model relationships for this scene.
Each row shows an event cascade that may occur during a single timestamp interval between frame renderings, as part of the X3D execution model.
Timer
TimeSensor |
No ROUTE connection found for output from this node. |
Worker
Script |
No ROUTE connection found for output from this node. Contains SFNode field with indirect access to another node. |
EFFS
ProtoInstance EFFS |
No ROUTE connection found for output from this node. Contains SFNode/MFNode field with indirect access to other nodes. |
<!--
Online at
https://www.web3d.org/x3d/content/examples/Basic/Followers/SliderIndex.html
-->
<!--
Version control at
https://sourceforge.net/p/x3d/code/HEAD/tree/www.web3d.org/x3d/content/examples/Basic/Followers/Slider.x3d
-->
<!--
Color legend: X3D terminology
<X3dNode
DEF='idName' field='value'/>
matches XML terminology
<XmlElement
DEF='idName' attribute='value'/>
(Light-blue background: event-based behavior node or statement)
(Grey background inside box: inserted documentation)
(Magenta background: X3D Extensibility)
<ProtoInstance
name='ProtoName'>
<field
name='fieldName'/> </ProtoInstance>
-->
<!-- For additional help information about X3D scenes, please see X3D Tooltips, X3D Resources, and X3D Scene Authoring Hints. -->