Skip to content

Instantly share code, notes, and snippets.

@andreasplesch
Last active September 10, 2023 03:52
Show Gist options
  • Save andreasplesch/3f7ea30b9860b6399c797c51e3235459 to your computer and use it in GitHub Desktop.
Save andreasplesch/3f7ea30b9860b6399c797c51e3235459 to your computer and use it in GitHub Desktop.
auto start timer
<X3D profile='Full' version='4.0'>
<head>
<meta content='cycletime.x3d' name='title'/>
<meta content='cycletime-movie.mpg' name='MovingImage'/>
<meta content='http://www.nist.gov/vrml.html' name='reference'/>
<meta content='http://www.itl.nist.gov/div897/ctg/vrml/vrml.html' name='reference'/>
<meta content='http://www.itl.nist.gov/div897/ctg/vrml/members.html' name='creator'/>
<meta content='This file was provided by the National Institute of Standards and Technology, and is part of the X3D Conformance Test Suite, available at http://www.nist.gov/vrml.html The information contained within this file is provided for use in establishing conformance to the ISO VRML97 Specification. Conformance to this test does not imply recommendation or endorsement by the National Institute of Standards and Technology. This software can be redistributed and/or modified freely provided that any derivative works bear some notice that they are derived from it, and any modified versions bear some notice that they have been modified.' name='disclaimer'/>
<meta content='Correct definition and compliance of this conformance scene is maintained by the X3D Working Group, https://www.web3d.org/working-groups/x3d' name='info'/>
<meta content='Michael Kass NIST, Don Brutzman NPS' name='translator'/>
<meta content='21 January 2001' name='translated'/>
<meta content='20 October 2019' name='modified'/>
<meta content='Test if TimeSensor sends cycleTime event at the start of each cycle. The world includes two TimeSensors: TIME1 and TIME2. The cycleTime field for TIME1 triggers startTime for TIME2. When clicking the red sphere, the ball starts to move, complete one cycle of animation in 2 seconds, stop, and move again after 3 seconds.' name='description'/>
<meta content='https://www.web3d.org/x3d/content/examples/ConformanceNist/Sensors/TimeSensor/cycletime.x3d' name='identifier'/>
<meta content='Vrml97ToX3dNist, http://ovrt.nist.gov/v2_x3d.html' name='generator'/>
<meta content='X3D-Edit 3.3, https://savage.nps.edu/X3D-Edit' name='generator'/>
<meta content='../../license.html' name='license'/>
</head>
<Scene>
<WorldInfo title='cycletime.x3d'/>
<Viewpoint/>
<TimeSensor DEF='TIME1' cycleInterval='1' loop='true' />
<TimeSensor DEF='TIME2' cycleInterval='9' />
<IntegerSequencer DEF='COUNTER' key='0 0.25 0.5 0.75 1' keyValue='0 1 2 3 4'/>
<Switch DEF='CHOICE' whichChoice='0'>
<Shape DEF='FOUR'>
<Appearance DEF='NumberAPP'>
<Material diffuseColor='0 0.2 0.2'></Material>
</Appearance>
<Text string='"4"'>
<FontStyle DEF='NumberStyle' style='BOLDITALIC' justify='"MIDDLE" "MIDDLE"' size='4'/>
</Text>
</Shape>
<Shape>
<Appearance USE='NumberAPP'/>
<Text string='"3"'>
<FontStyle USE='NumberStyle'/>
</Text>
</Shape>
<Shape>
<Appearance USE='NumberAPP'/>
<Text string='"2"'>
<FontStyle USE='NumberStyle'/>
</Text>
</Shape>
<Shape>
<Appearance USE='NumberAPP'/>
<Text string='"1"'>
<FontStyle USE='NumberStyle'/>
</Text>
</Shape>
<Transform DEF='BALL'>
<Inline url='"https://raw.githubusercontent.com/KhronosGroup/glTF-Sample-Models/master/2.0/MetalRoughSpheres/glTF/MetalRoughSpheres.gltf"'/>
</Transform>
</Switch>
<ROUTE fromField='cycleTime' fromNode='TIME1' toField='stopTime' toNode='TIME1'/>
<ROUTE fromField='cycleTime' fromNode='TIME1' toField='startTime' toNode='TIME2'/>
<ROUTE fromField='fraction_changed' fromNode='TIME2' toField='set_fraction' toNode='COUNTER'/>
<ROUTE fromField='value_changed' fromNode='COUNTER' toField='whichChoice' toNode='CHOICE'/>
</Scene>
</X3D>
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE X3D PUBLIC "ISO//Web3D//DTD X3D 3.0//EN" "https://www.web3d.org/specifications/x3d-3.0.dtd">
<X3D profile='Interactive' version='3.0' xmlns:xsd='http://www.w3.org/2001/XMLSchema-instance' xsd:noNamespaceSchemaLocation='https://www.web3d.org/specifications/x3d-3.0.xsd'>
<head>
<meta content='cycletimeJoe.x3d' name='from by Joe'/>
</head>
<Scene>
<WorldInfo title='cycletimeJoe.x3d'/>
<Viewpoint/>
<TimeSensor DEF='REDTIME1' cycleInterval='1' loop='true'/>
<TimeSensor DEF='GREENTIME2' cycleInterval='5' loop='false'/>
<TimeSensor DEF='BLUETIME3' cycleInterval='10' loop='false'/>
<BooleanFilter DEF='GREENFILTER'/>
<TimeTrigger DEF='BLUETRIGGER'/>
<ROUTE fromField='cycleTime' fromNode='REDTIME1' toField='set_stopTime' toNode='REDTIME1'/>
<ROUTE fromField='stopTime' fromNode='REDTIME1' toField='set_startTime' toNode='GREENTIME2'/>
<ROUTE fromField='isActive' fromNode='GREENTIME2' toField='set_boolean' toNode='GREENFILTER'/>
<ROUTE fromField='inputFalse' fromNode='GREENFILTER' toField='set_boolean' toNode='BLUETRIGGER'/>
<ROUTE fromField='triggerTime' fromNode='BLUETRIGGER' toField='set_startTime' toNode='BLUETIME3'/>
<!-- <ROUTE fromField='stopTime' fromNode='GREENTIME2' toField='set_startTime' toNode='BLUETIME3'/> -->
<Transform DEF='REDBALL'>
<Shape>
<Appearance>
<Material diffuseColor='1 0 0'/>
</Appearance>
<Sphere/>
</Shape>
</Transform>
<Transform DEF='GREENBALL' translation='0 0 0' >
<Shape>
<Appearance>
<Material diffuseColor='0 1 0'/>
</Appearance>
<Sphere/>
</Shape>
</Transform>
<Transform DEF='BLUEBALL'>
<Shape>
<Appearance>
<Material diffuseColor='0 0 1'/>
</Appearance>
<Sphere/>
</Shape>
</Transform>
<PositionInterpolator DEF='REDINTERP1' key='0 0.25 0.5 0.75 1' keyValue='0 0 0 2 0 0 0 0 0 -2 0 0 0 0 0'/>
<PositionInterpolator DEF='GREENINTERP2' key='0 0.25 0.5 0.75 1' keyValue='0 0 0 0 2 0 0 0 0 0 -2 0 0 0 0'/>
<PositionInterpolator DEF='BLUEINTERP3' key='0 0.25 0.5 0.75 1' keyValue='0 0 0 0 -2 0 0 0 0 0 2 0 0 0 0'/>
<ROUTE fromField='fraction_changed' fromNode='REDTIME1' toField='set_fraction' toNode='REDINTERP1'/>
<ROUTE fromField='value_changed' fromNode='REDINTERP1' toField='set_translation' toNode='REDBALL'/>
<ROUTE fromField='fraction_changed' fromNode='GREENTIME2' toField='set_fraction' toNode='GREENINTERP2'/>
<ROUTE fromField='value_changed' fromNode='GREENINTERP2' toField='set_translation' toNode='GREENBALL'/>
<ROUTE fromField='fraction_changed' fromNode='BLUETIME3' toField='set_fraction' toNode='BLUEINTERP3'/>
<ROUTE fromField='value_changed' fromNode='BLUEINTERP3' toField='set_translation' toNode='BLUEBALL'/>
</Scene>
</X3D>
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE X3D PUBLIC "ISO//Web3D//DTD X3D 3.0//EN" "https://www.web3d.org/specifications/x3d-3.0.dtd">
<X3D profile='Interactive' version='3.0' xmlns:xsd='http://www.w3.org/2001/XMLSchema-instance' xsd:noNamespaceSchemaLocation='https://www.web3d.org/specifications/x3d-3.0.xsd'>
<head>
<meta content='cycletime.x3d' name='title'/>
<meta content='cycletime-movie.mpg' name='MovingImage'/>
<meta content='http://www.nist.gov/vrml.html' name='reference'/>
<meta content='http://www.itl.nist.gov/div897/ctg/vrml/vrml.html' name='reference'/>
<meta content='http://www.itl.nist.gov/div897/ctg/vrml/members.html' name='creator'/>
<meta content='This file was provided by the National Institute of Standards and Technology, and is part of the X3D Conformance Test Suite, available at http://www.nist.gov/vrml.html The information contained within this file is provided for use in establishing conformance to the ISO VRML97 Specification. Conformance to this test does not imply recommendation or endorsement by the National Institute of Standards and Technology. This software can be redistributed and/or modified freely provided that any derivative works bear some notice that they are derived from it, and any modified versions bear some notice that they have been modified.' name='disclaimer'/>
<meta content='Correct definition and compliance of this conformance scene is maintained by the X3D Working Group, https://www.web3d.org/working-groups/x3d' name='info'/>
<meta content='Michael Kass NIST, Don Brutzman NPS' name='translator'/>
<meta content='21 January 2001' name='translated'/>
<meta content='20 October 2019' name='modified'/>
<meta content='Test if TimeSensor sends cycleTime event at the start of each cycle. The world includes two TimeSensors: TIME1 and TIME2. The cycleTime field for TIME1 triggers startTime for TIME2. When clicking the red sphere, the ball starts to move, complete one cycle of animation in 2 seconds, stop, and move again after 3 seconds.' name='description'/>
<meta content='https://www.web3d.org/x3d/content/examples/ConformanceNist/Sensors/TimeSensor/cycletime.x3d' name='identifier'/>
<meta content='Vrml97ToX3dNist, http://ovrt.nist.gov/v2_x3d.html' name='generator'/>
<meta content='X3D-Edit 3.3, https://savage.nps.edu/X3D-Edit' name='generator'/>
<meta content='../../license.html' name='license'/>
</head>
<Scene>
<WorldInfo title='cycletime.x3d'/>
<Viewpoint/>
<!-- <TimeSensor DEF='TIME1' cycleInterval='5' loop='true' stopTime='1'/> -->
<TimeSensor DEF='TIME1' cycleInterval='1' loop='true' />
<TimeSensor DEF='TIME2' cycleInterval='9' />
<!-- <TouchSensor DEF='TOUCH' description='touch to activate'/> -->
<PositionInterpolator DEF='INTERP' key='0 0.25 0.5 0.75 1' keyValue='0 0 0 3 0 0 0 0 0 -3 0 0 0 0 0' onoutputchange='//console.log("a", event)'/>
<Transform DEF='BALL'>
<Shape>
<Appearance>
<Material diffuseColor='1 0 0'/>
</Appearance>
<Sphere/>
</Shape>
</Transform>
<!-- <ROUTE fromField='touchTime' fromNode='TOUCH' toField='startTime' toNode='TIME1'/> -->
<ROUTE fromField='cycleTime' fromNode='TIME1' toField='stopTime' toNode='TIME1'/>
<ROUTE fromField='stopTime' fromNode='TIME1' toField='startTime' toNode='TIME2'/>
<ROUTE fromField='fraction_changed' fromNode='TIME2' toField='set_fraction' toNode='INTERP'/>
<ROUTE fromField='value_changed' fromNode='INTERP' toField='translation' toNode='BALL'/>
</Scene>
</X3D>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment