| Cover | TOC | Chap | Prev Chap | Prev Fig | Next Fig | Next Chap |
|
Figure 10.12
A cube that bounces forward and back as an interpolator remaps time. |
|
|
Click on the image to view the VRML scene. |
#VRML V2.0 utf8
# The VRML 2.0 Sourcebook
# Copyright (c) 1997
# Andrea L. Ames, David R. Nadeau, and John L. Moreland
Group {
children [
# Moving box
DEF Cube Transform {
children Shape {
appearance Appearance {
material Material {
diffuseColor 1.0 1.0 0.0
}
}
geometry Box { size 1.0 1.0 1.0 }
}
},
# Animation clock
DEF Clock TimeSensor {
cycleInterval 4.0
loop TRUE
},
# Animation controller
DEF CubeController ScalarInterpolator {
key [ 0.0, 0.5, 1.0 ]
keyValue [ 0.0, 1.0, 0.0 ]
},
# Animation path
DEF CubePath PositionInterpolator {
key [
0.00, 0.11, 0.17, 0.22,
0.33, 0.44, 0.50, 0.55,
0.66, 0.77, 0.83, 0.88,
0.99
]
keyValue [
0.0 0.0 0.0, 1.0 1.96 1.0,
1.5 2.21 1.5, 2.0 1.96 2.0,
3.0 0.0 3.0, 2.0 1.96 3.0,
1.5 2.21 3.0, 1.0 1.96 3.0,
0.0 0.0 3.0, 0.0 1.96 2.0,
0.0 2.21 1.5, 0.0 1.96 1.0,
0.0 0.0 0.0
]
}
]
}
ROUTE Clock.fraction_changed TO CubeController.set_fraction
ROUTE CubeController.value_changed TO CubePath.set_fraction
ROUTE CubePath.value_changed TO Cube.set_translation