[x3d-public] Turning on and off simultaneous animations individually
John Carlson
yottzumm at gmail.com
Sat Dec 7 14:56:36 PST 2024
Joe suggested using an event hierarchy, and then only adding and removing
one event per facial expression as you turn them on an off.
Everything is visible here, it’s about controlling all animations (and any
subset) with only a single TimeSensor.
Putting sensors in a Switch is another possibility, but the goal is to have
a single sensor, so we can have several facial expressions (any combination
potentially) running on the same sensor.
My ideal was to have several Switches, one per facial expression. Then
have a Group with ROUTEs and one without. I’m guessing that doesn’t agree
with the specification.
You’re welcome to see what we have:
https://github.com/coderextreme/ci2had/blob/main/resources/SingleMenuJin.x3d
Just realize that we want to toggle on and off menu items in groups.
Note that the image is copyright HP, so use care when copying. You
probably have it from before I knew about the copyright.
Fun stuff!
John
On Sat, Dec 7, 2024 at 4:18 PM Holger Seelig via x3d-public <
x3d-public at web3d.org> wrote:
> When I want to activate/deactivate something is a Switch when it becomes
> visible or hidden, I like to use VisiblitySensor or ProximitySensor nodes.
> Put a sensor node in every branch of the Switch. They send a *isActive*
> event (SFBool) and *enterTime*, *exitTime* (SFTime). I guess that’s exactly
> what you are looking for.
>
> Best regards,
> Holger
>
> --
> Holger Seelig
> Leipzig, Germany
>
> holger.seelig at yahoo.de
> https://create3000.github.io/x_ite/
>
> Am 07.12.2024 um 23:08 schrieb John Carlson via x3d-public <
> x3d-public at web3d.org>:
>
> Here’s something for me to try. It hadn’t occurred to me to use a Script
> to toggle a Switch, very interesting.
>
> <?xml version="1.0" encoding="UTF-8"?> <!DOCTYPE X3D PUBLIC "ISO//Web3D//DTD
> X3D 3.3//EN" "http://www.web3d.org/specifications/x3d-3.3.dtd"> <X3D
> profile='Immersive' version='3.3'> <Scene> <Switch whichChoice='0' DEF='
> NavigationSwitch'> <Transform DEF='Option1'> <Shape> <Appearance> <
> Material diffuseColor='1 0 0'/> </Appearance> <Box size='1 1 1'/> </Shape>
> <TimeSensor DEF='RedTimer' cycleInterval='2' loop='true'/> <
> ColorInterpolator DEF='RedColorChanger' key='0 0.5 1' keyValue='1 0 0,
> 0.8 0 0, 1 0 0'/> <ROUTE fromNode='RedTimer' fromField='fraction_changed'
> toNode='RedColorChanger' toField='set_fraction'/> </Transform> <Transform
> DEF='Option2'> <Shape> <Appearance> <Material diffuseColor='0 1 0'/> </
> Appearance> <Sphere radius='1'/> </Shape> <TimeSensor DEF='GreenTimer'
> cycleInterval='3' loop='true'/> <ColorInterpolator DEF='GreenColorChanger'
> key='0 0.5 1' keyValue='0 1 0, 0 0.8 0, 0 1 0'/> <ROUTE fromNode='
> GreenTimer' fromField='fraction_changed' toNode='GreenColorChanger'
> toField='set_fraction'/> </Transform> </Switch> <!-- Script to switch
> between options --> <Script DEF='SwitchController'> <field name='
> currentChoice' type='SFInt32' accessType='inputOutput' value='0'/> <field
> name='toggle' type='SFBool' accessType='inputOutput' value='false'/> <body
> ><![CDATA[ function toggle(value) { currentChoice = 1 - currentChoice; return
> currentChoice; } ]]></body> </Script> <TimeTrigger DEF='SwitchTrigger'/> <
> ROUTE fromNode='SwitchTrigger' fromField='triggerTime' toNode='
> SwitchController' toField='toggle'/> <ROUTE fromNode='SwitchController'
> fromField='currentChoice' toNode='NavigationSwitch' toField='whichChoice'
> /> </Scene> </X3D>
> _______________________________________________
> x3d-public mailing list
> x3d-public at web3d.org
> http://web3d.org/mailman/listinfo/x3d-public_web3d.org
>
>
> _______________________________________________
> x3d-public mailing list
> x3d-public at web3d.org
> http://web3d.org/mailman/listinfo/x3d-public_web3d.org
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://web3d.org/pipermail/x3d-public_web3d.org/attachments/20241207/eec94082/attachment-0001.html>
More information about the x3d-public
mailing list