Cover TOC Chap Prev Chap Prev Fig Next Fig Next Chap

Chapter 8: Animating Position, Orientation, and Scale

../ch08/08fig03.gif
Figure 8.3

An animation that moves a coordinate system and the cube built within it along a bouncing path.

08fig03.wrl
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 { }
                }
                geometry Box { size 1.0 1.0 1.0 }
            }
        },
    # Animation clock
        DEF Clock TimeSensor {
            cycleInterval 4.0
            loop TRUE
        },
    # 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 CubePath.set_fraction
ROUTE CubePath.value_changed TO Cube.set_translation