<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE X3D PUBLIC "ISO//Web3D//DTD X3D 3.3//EN" "https://www.web3d.org/specifications/x3d-3.3.dtd">
<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'>
  <head>
    <!-- Note that the following component statement is needed to add PositionInterpolator2D to Immersive profile nodes -->
    <component level='3' name='Interpolation'/>
    <meta content='PositionInterpolator2dExample.x3d' name='title'/>
    <meta 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.' name='description'/>
    <meta content='Don Brutzman' name='creator'/>
    <meta content='16 October 2001' name='created'/>
    <meta content='14 June 2020' name='modified'/>
    <meta content='PositionInterpolator2D' name='subject'/>
    <meta content='https://www.web3d.org/x3d/content/examples/X3dForWebAuthors/Chapter07EventAnimationInterpolation/PositionInterpolator2dExample.x3d' name='identifier'/>
    <meta content='https://www.web3d.org/x3d/content/examples/Basic/development/PositionInterpolator2dExample.x3d' name='reference'/>
    <meta content='X3D-Edit 3.3, https://www.web3d.org/x3d/tools/X3D-Edit' name='generator'/>
    <meta content='../license.html' name='license'/>
  </head>
  <Scene>
    <WorldInfo title='PositionInterpolator2dExample.x3d'/>
    <Viewpoint description='Click to activate animation' position='0 0 3'/>
    <TimeSensor DEF='Clock' cycleInterval='10' enabled='false' loop='true'/>
    <!-- author fun: experiment by comparing results with keyValue='1 1 1 3 1 3 0.8 0.8 1 1 1 1' -->
    <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'/>
    <ROUTE fromField='fraction_changed' fromNode='Clock' toField='set_fraction' toNode='InterpolateTTscale'/>
    <Transform DEF='ImageAspectRatio' scale='1.5 1 1'>
      <TouchSensor DEF='Toucher' description='click and hold to animate TextureTransform'/>
      <ROUTE fromField='isActive' fromNode='Toucher' toField='enabled' toNode='Clock'/>
      <Shape>
        <!-- solid='true' means single-sided rendering -->
        <IndexedFaceSet coordIndex='0 1 2 3 0 -1'>
          <!-- note how DEF names can be self-documenting -->
          <Coordinate DEF='TwoByTwoSquare' point='-1 -1 0 1 -1 0 1 1 0 -1 1 0'/>
        </IndexedFaceSet>
        <Appearance>
          <ImageTexture DEF='ContactImage' url='"JavaBoardSmileForTheCamera.jpg" "https://www.web3d.org/x3d/content/examples/X3dForWebAuthors/Chapter07EventAnimationInterpolation/JavaBoardSmileForTheCamera.jpg"'/>
          <TextureTransform DEF='TextureTransformNode'/>
        </Appearance>
      </Shape>
      <!-- author fun: replace destination toField from 'set_scale' with new value of 'set_translation' or 'set_center' -->
      <ROUTE fromField='value_changed' fromNode='InterpolateTTscale' toField='set_scale' toNode='TextureTransformNode'/>
    </Transform>
  </Scene>
</X3D>