[x3d-public] event utility usage

Andreas Plesch andreasplesch at gmail.com
Sat Oct 29 08:19:07 PDT 2016


I updated

https://rawgit.com/andreasplesch/cobweb_dom/proto/tests/interactiveTransformations.xhtml

to show a fade-in/out effect for the rotor handles when hovering over the
teapot, and decided to use event utilities rather than scripting.

It was quick to see that TimeTrigger could be used to trigger the fade
animation as TouchSensor does not generate a time event for just hovering.
It was harder for me to recognize that BooleanFilter would allow for
invoking the different interpolators for fading in and fading out.

Here is the relevant animation section:

<!-- fade gizmo in and out -->
<TimeSensor DEF='timerIn' cycleInterval='1' enabled='true' />
<TimeSensor DEF='timerOut' cycleInterval='1' enabled='true' />
<TimeTrigger DEF='getTimeIn' />
<TimeTrigger DEF='getTimeOut' />
<BooleanFilter DEF='splitBool' />
<ROUTE fromNode='bandsSensor' fromField='isOver' toNode='splitBool'
toField='set_boolean' />
<ROUTE fromNode='splitBool' fromField='inputTrue' toNode='getTimeIn'
toField='set_boolean' />
<ROUTE fromNode='splitBool' fromField='inputFalse' toNode='getTimeOut'
toField='set_boolean' />
<ROUTE fromNode='getTimeIn' fromField='triggerTime' toNode='timerIn'
toField='startTime' />
<ROUTE fromNode='getTimeOut' fromField='triggerTime' toNode='timerOut'
toField='startTime' />
<ScalarInterpolator DEF='fadeIn' key='0 0.5 1' keyValue='0.9 0.25 0' />
<ScalarInterpolator DEF='fadeOut' key='0 0.5 1' keyValue='0 0.75 0.9' />
<ROUTE fromNode='timerIn' fromField='fraction_changed' toNode='fadeIn'
toField='set_fraction' />
<ROUTE fromNode='timerOut' fromField='fraction_changed' toNode='fadeOut'
toField='set_fraction' />
<ROUTE fromNode='fadeIn' fromField='value_changed' toNode='RED_APP_Mat'
toField='transparency' />
<ROUTE fromNode='fadeOut' fromField='value_changed' toNode='RED_APP_Mat'
toField='transparency' />


It looks rather verbose and I am wondering if there is a more concise way
to achieve the same effect without scripting ? The answer may well be to
use a script.

I also learned that it can be useful to 'debug' the flow of x3d events. One
way is to have a script log things to the console. Are there builtin tools
in x3d editors to help with tracing events (perhaps as they happen) ?

-Andreas






-- 
Andreas Plesch
39 Barbara Rd.
Waltham, MA 02453
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://web3d.org/pipermail/x3d-public_web3d.org/attachments/20161029/96d08dbf/attachment.html>


More information about the x3d-public mailing list