1 |
<?xml version="1.0" encoding="UTF-8"?>
|
2 |
<!DOCTYPE X3D PUBLIC "ISO//Web3D//DTD X3D 3.3//EN" "https://www.web3d.org/specifications/x3d-3.3.dtd">
|
3 | <X3D profile='Immersive' version='3.3' xmlns:xsd='http://www.w3.org/2001/XMLSchema-instance' xsd:noNamespaceSchemaLocation='https://www.web3d.org/specifications/x3d-3.3.xsd'> |
4 | <head> |
5 | <component level='3' name='Interpolation'/> |
6 | <meta name='title' content='CoordinateInterpolator2dExample.x3d'/> |
7 | <meta name='description' content='Example to interpolate using CoordinateInterpolator2D - select and hold geometry for a user-controlled animation loop.'/> |
8 | <meta name='creator' content='Don Brutzman, Jeff Weekley, Jane Wu'/> |
9 | <meta name='created' content='9 October 2001'/> |
10 | <meta name='modified' content='31 August 2023'/> |
11 | <meta name='subject' content='CoordinateInterpolator2D'/> |
12 |
<meta name='Image' content='CoordinateInterpolator2dExamplePhoneTouchScreenImage.png'![]() |
13 | <meta name='reference' content='[x3d-public] TimeSensor Control https://web3d.org/pipermail/x3d-public_web3d.org/2023-August/019468.html'/> |
14 | <meta name='identifier' content='https://www.web3d.org/x3d/content/examples/X3dForWebAuthors/Chapter07EventAnimationInterpolation/CoordinateInterpolator2dExample.x3d'/> |
15 | <meta name='reference' content='https://www.web3d.org/x3d/content/examples/Basic/development/CoordinateInterpolator2dExample.x3d'/> |
16 | <meta name='generator' content='X3D-Edit 3.3, https://savage.nps.edu/X3D-Edit'/> |
17 | <meta name='license' content='../license.html'/> |
18 | </head> |
19 | <Scene> |
20 | <WorldInfo title='CoordinateInterpolator2dExample.x3d'/> |
21 | <Viewpoint description='Click to activate animation' orientation='1 0 0 -0.4' position='0 4 10'/> |
22 |
<!-- ROUTE information for Clock node:
[from Toucher.isActive to enabled
]
[from Toucher.touchTime to startTime
]
[from fraction_changed to InterpolateCrossSection.set_fraction
]
-->
<TimeSensor DEF='Clock' cycleInterval='5' enabled='false' loop='true'/> |
23 |
<!-- ROUTE information for InterpolateCrossSection node:
[from Clock.fraction_changed to set_fraction
]
[from value_changed to AnimatedCrossSectionExtrusion.set_crossSection
]
-->
<CoordinateInterpolator2D DEF='InterpolateCrossSection' key='0 0.45 0.9 1' keyValue='1 1 1 -1 -1 -1 -1 1 1 1 2 2 2 -2 -1 -1 -1 1 2 2 1 1 1 -1 -1 -1 -1 1 1 1 1 1 1 -1 -1 -1 -1 1 1 1'/> |
24 | < ROUTE fromNode='Clock' fromField='fraction_changed' toNode='InterpolateCrossSection' toField='set_fraction'/> |
25 | <Transform translation='1.15 1 0'> |
26 | <!-- & is the XML escape character code for ampersand character --> |
27 |
<!-- ROUTE information for Toucher node:
[from isActive to Clock.enabled
]
[from touchTime to Clock.startTime
]
-->
<TouchSensor DEF='Toucher' description='select & hold shape to animate Extrusion'/> |
28 | < ROUTE fromNode='Toucher' fromField='isActive' toNode='Clock' toField='enabled'/> |
29 | <!-- also reset clock to restart --> |
30 | < ROUTE fromNode='Toucher' fromField='touchTime' toNode='Clock' toField='startTime'/> |
31 | <Shape> |
32 | <Appearance> |
33 | <Material diffuseColor='0.2 0.8 0.4' emissiveColor='0.05 0.2 0.1'/> |
34 | </Appearance> |
35 |
<!-- ROUTE information for AnimatedCrossSectionExtrusion node:
[from InterpolateCrossSection.value_changed to set_crossSection
]
-->
<Extrusion DEF='AnimatedCrossSectionExtrusion' spine='-4 0 -2 -1 0 -2 2 0 1 2 0 4'/> |
36 | <!-- default Extrusion crossSection='1 1 1 -1 -1 -1 -1 1 1 1' is a square --> |
37 | </Shape> |
38 | < ROUTE fromNode='InterpolateCrossSection' fromField='value_changed' toNode='AnimatedCrossSectionExtrusion' toField='set_crossSection'/> |
39 | </Transform> |
40 | <Transform translation='-1.5 -1 2'> |
41 | <Billboard axisOfRotation='0 0 0'> |
42 | <Shape> |
43 | <Text string='"select & hold shape" "to animate Extrusion"'> |
44 | <FontStyle family='"SANS"' justify='"MIDDLE" "MIDDLE"' size='0.8'/> |
45 | </Text> |
46 | <Appearance> |
47 | <Material diffuseColor='0.8 0.4 0.2'/> |
48 | </Appearance> |
49 | </Shape> |
50 | </Billboard> |
51 | </Transform> |
52 | </Scene> |
53 | </X3D> |
Event Graph ROUTE Table entries with 4 ROUTE connections 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.
Toucher
TouchSensor isActive SFBool |
Clock
TimeSensor enabled SFBool |
then
|
Clock
TimeSensor fraction_changed SFFloat |
InterpolateCrossSection
CoordinateInterpolator2D set_fraction SFFloat |
then
|
InterpolateCrossSection
CoordinateInterpolator2D value_changed MFVec2f |
AnimatedCrossSectionExtrusion
Extrusion set_crossSection MFVec2f |
|||
Toucher
TouchSensor touchTime SFTime |
Clock
TimeSensor startTime SFTime |
then
|
Clock
TimeSensor fraction_changed SFFloat |
InterpolateCrossSection
CoordinateInterpolator2D set_fraction SFFloat |
then
|
InterpolateCrossSection
CoordinateInterpolator2D value_changed MFVec2f |
AnimatedCrossSectionExtrusion
Extrusion set_crossSection MFVec2f |
<!--
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)
-->
<!--
For additional help information about X3D scenes, please see X3D Tooltips, X3D Resources, and X3D Scene Authoring Hints.
-->