Introduction to 3D Graphics and VRML

[ Previous | Index | Next ]


Animation (cont...)

OrientationInterpolator example

This is a rotating box

VRML Animation example

#VRML V2.0 utf8
Group {

    ...

    DEF GreenBox Transform {
      children [
        Shape {
          appearance Appearance {
            material Material {
              diffuseColor 0.0 1.0 0.0
            }
          }
          geometry Box {
            size 2.0 2.0 2.0
          }
        }
      ]
    },
    DEF Clock TimeSensor {
      enabled TRUE
      cycleInterval 5.0
      loop TRUE
    },
    DEF Path OrientationInterpolator {
      key [ 0.0 0.5 1.0 ]
      keyValue [
        0.0 1.0 1.0 0.0,
        0.0 1.0 1.0 3.14,
        0.0 1.0 1.0 6.28
      ]
    }
  ]
}

ROUTE Clock.fraction_changed TO Path.set_fraction
ROUTE Path.value_changed     TO GreenBox.set_rotation

Author: Michael Louka (Michael.Louka@of.telia.no)
Last Updated: 20 November 1997