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 | <!-- Note that the following component statement is needed to add PositionInterpolator2D to Immersive profile nodes --> |
6 | <component level='3' name='Interpolation'/> |
7 | <meta name='title' content='PositionInterpolator2dExample.x3d'/> |
8 | <meta name='description' content='Interpolation example using PositionInterpolator2D, user can touch (select) the geometry to activate an animation loop that rescales the image texture superimposed on the geometry.'/> |
9 | <meta name='creator' content='Don Brutzman'/> |
10 | <meta name='created' content='16 October 2001'/> |
11 | <meta name='modified' content='14 June 2020'/> |
12 | <meta name='subject' content='PositionInterpolator2D'/> |
13 | <meta name='identifier' content='https://www.web3d.org/x3d/content/examples/X3dForWebAuthors/Chapter07EventAnimationInterpolation/PositionInterpolator2dExample.x3d'/> |
14 | <meta name='reference' content='https://www.web3d.org/x3d/content/examples/Basic/development/PositionInterpolator2dExample.x3d'/> |
15 | <meta name='generator' content='X3D-Edit 3.3, https://savage.nps.edu/X3D-Edit'/> |
16 | <meta name='license' content='../license.html'/> |
17 | </head> |
18 | <Scene> |
19 | <WorldInfo title='PositionInterpolator2dExample.x3d'/> |
20 | <Viewpoint description='Click to activate animation' position='0 0 3'/> |
21 |
<!-- ROUTE information for Clock node:
[from Toucher.isActive to enabled
]
[from fraction_changed to InterpolateTTscale.set_fraction
]
-->
<TimeSensor DEF='Clock' cycleInterval='10' enabled='false' loop='true'/> |
22 | <!-- author fun: experiment by comparing results with keyValue='1 1 1 3 1 3 0.8 0.8 1 1 1 1' --> |
23 |
<!-- ROUTE information for InterpolateTTscale node:
[from Clock.fraction_changed to set_fraction
]
[from value_changed to TextureTransformNode.set_scale
]
-->
<PositionInterpolator2D DEF='InterpolateTTscale' key='0 0.35 0.45 0.8 0.9 1' keyValue='1 1 3 3 3 3 0.8 0.8 1 1 1 1'/> |
24 | < ROUTE fromNode='Clock' fromField='fraction_changed' toNode='InterpolateTTscale' toField='set_fraction'/> |
25 | <Transform DEF='ImageAspectRatio' scale='1.5 1 1'> |
26 |
<!-- ROUTE information for Toucher node:
[from isActive to Clock.enabled
]
-->
<TouchSensor DEF='Toucher' description='click and hold to animate TextureTransform'/> |
27 | < ROUTE fromNode='Toucher' fromField='isActive' toNode='Clock' toField='enabled'/> |
28 | <Shape> |
29 | <!-- solid='true' means single-sided rendering --> |
30 | <IndexedFaceSet coordIndex='0 1 2 3 0 -1'> |
31 | <!-- note how DEF names can be self-documenting --> |
32 | <Coordinate DEF='TwoByTwoSquare' point='-1 -1 0 1 -1 0 1 1 0 -1 1 0'/> |
33 | </IndexedFaceSet> |
34 | <Appearance> |
35 | <ImageTexture DEF='ContactImage' url=' "JavaBoardSmileForTheCamera.jpg " "https://www.web3d.org/x3d/content/examples/X3dForWebAuthors/Chapter07EventAnimationInterpolation/JavaBoardSmileForTheCamera.jpg " '/> |
36 |
<!-- ROUTE information for TextureTransformNode node:
[from InterpolateTTscale.value_changed to set_scale
]
-->
<TextureTransform DEF='TextureTransformNode'/> |
37 | </Appearance> |
38 | </Shape> |
39 | <!-- author fun: replace destination toField from 'set_scale' with new value of 'set_translation' or 'set_center' --> |
40 | < ROUTE fromNode='InterpolateTTscale' fromField='value_changed' toNode='TextureTransformNode' toField='set_scale'/> |
41 | </Transform> |
42 | </Scene> |
43 | </X3D> |
Event Graph ROUTE Table entries with 3 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 |
InterpolateTTscale
PositionInterpolator2D set_fraction SFFloat |
then
|
InterpolateTTscale
PositionInterpolator2D value_changed SFVec2f |
TextureTransformNode
TextureTransform set_scale SFVec2f |
<!--
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. -->