#VRML V2.0 utf8 ## ##@+ interpolator ## ##

interpolator

##

This example is to illustrate the use of a ##timesensor and interpolator. In another example, ##the interpolator will be replaced by a script. ## ## ##

shape

## Shape { ## # The shape geometry Sphere { radius 2 } ## # we will modify the Material (DEF) appearance Appearance { material DEF MATERIAL Material { diffuseColor 1 0 0 } } ##

} ##
##
##

The next section gives the code for the interpolor ##and the routing. Remember ##

##@ timesensor ## The TimeSensor activates the color change DEF TIME TimeSensor { loop TRUE cycleInterval 5 } # ## We use a simple ColorInterpolator (analog) DEF COLORS ColorInterpolator { key [ 0 0.5 1 ] keyValue [ 1 0 0, 0 0 1, 1 0 0 ] } # ## # Finally, we wire the events ROUTE TIME.fraction_changed TO COLORS.set_fraction ROUTE COLORS.value_changed TO MATERIAL.diffuseColor ## #... ##