Skip to content

Instantly share code, notes, and snippets.

@andreasplesch
Last active May 27, 2020 20:55
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save andreasplesch/f959aaaf04475922bdfbdf1aaca8476b to your computer and use it in GitHub Desktop.
Save andreasplesch/f959aaaf04475922bdfbdf1aaca8476b to your computer and use it in GitHub Desktop.
InlineNameScope
<?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 xmlns:xsd="http://www.w3.org/2001/XMLSchema-instance" profile="Immersive" version="3.3" xsd:noNamespaceSchemaLocation="http://www.web3d.org/specifications/x3d-3.3.xsd">
<Scene>
<Shape>
<Box />
<Appearance>
<Material DEF="SphereMaterial" diffuseColor="0.041176 0.027451 0.5"/>
</Appearance>
</Shape>
<Transform position='2 0 0'>
<Inline url='"ScalarInterpolator.x3d"' />
</Transform>
<ScalarInterpolator DEF='TransparencyAnimator' key='0 0.5 1' keyValue='0 0.5 0'/>
<TimeSensor DEF='AnimationClock' cycleInterval='1' loop='true'/>
<ROUTE fromField='fraction_changed' fromNode='AnimationClock' toField='set_fraction' toNode='TransparencyAnimator'/>
<ROUTE fromField='value_changed' fromNode='TransparencyAnimator' toField='transparency' toNode='SphereMaterial'/>
</Scene>
</X3D>
<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8"/>
<link rel="stylesheet" type="text/css" href="https://code.create3000.de/x_ite/4.6.10/dist/x_ite.css"/>
<script type="text/javascript" src="https://code.create3000.de/x_ite/4.6.10/dist/x_ite.min.js"></script>
<style type="text/css">
X3DCanvas {
width: 768px;
height: 432px;
}
</style>
</head>
<body>
<X3DCanvas src="MainScene.x3d">
<p>Your browser may not support all features required by X_ITE.
For a better experience, keep your browser up to date.
<a href="http://outdatedbrowser.com">Check here for latest versions.</a></p>
</X3DCanvas>
</body>
</html>
<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8"/>
<script type='text/javascript' src='https://www.x3dom.org/download/dev/x3dom-full.debug.js'> </script>
<link rel='stylesheet' type='text/css' href='https://www.x3dom.org/download/dev/x3dom.css'></link>
</head>
<body>
<X3D>
<Scene>
<Inline url="MainScene.x3d">
</Inline>
</Scene>
</X3D>
</body>
</html>
<?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' xmlns:xsd='http://www.w3.org/2001/XMLSchema-instance' xsd:noNamespaceSchemaLocation='http://www.web3d.org/specifications/x3d-3.3.xsd'>
<head>
<meta content='ScalarInterpolator.x3d' name='title'/>
<meta content='Demonstrate use of ScalarInterpolator to animate transparency.' name='description'/>
<meta content='Don Brutzman' name='creator'/>
<meta content='28 January 2008' name='created'/>
<meta content='20 October 2019' name='modified'/>
<meta content='http://X3dGraphics.com' name='reference'/>
<meta content='https://www.web3d.org/x3d/content/examples/X3dResources.html' name='reference'/>
<meta content='Copyright Don Brutzman and Leonard Daly 2007' name='rights'/>
<meta content='X3D book, X3D graphics, X3D-Edit, http://www.x3dGraphics.com' name='subject'/>
<meta content='http://X3dGraphics.com/examples/X3dForWebAuthors/Chapter07EventAnimationInterpolation/ScalarInterpolator.x3d' name='identifier'/>
<meta content='X3D-Edit 3.3, https://savage.nps.edu/X3D-Edit' name='generator'/>
<meta content='../license.html' name='license'/>
</head>
<Scene>
<WorldInfo title='ScalarInterpolator.x3d'/>
<Transform translation='0 -1 0'>
<Shape>
<Sphere radius='2'/>
<Appearance>
<Material DEF='SphereMaterial' diffuseColor='0.941176 0.027451 0'/>
</Appearance>
</Shape>
</Transform>
<!-- note that final value equals first value in keyValue array in order to support smooth looping -->
<ScalarInterpolator DEF='TransparencyAnimator' key='0 0.5 1' keyValue='0 1 0'/>
<TimeSensor DEF='AnimationClock' cycleInterval='8' loop='true'/>
<ROUTE fromField='fraction_changed' fromNode='AnimationClock' toField='set_fraction' toNode='TransparencyAnimator'/>
<ROUTE fromField='value_changed' fromNode='TransparencyAnimator' toField='transparency' toNode='SphereMaterial'/>
<!-- notice that Text appears later in scene although it is located above Sphere -->
<Transform translation='0 1.5 0'>
<Shape>
<Text string='"Animating transparency" "using ScalarInterpolator"'>
<FontStyle justify='"MIDDLE" "MIDDLE"'/>
</Text>
<Appearance DEF='TextAppearance'>
<Material diffuseColor='0 0.7 0.7'/>
</Appearance>
</Shape>
</Transform>
</Scene>
</X3D>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment