http://tecfa.unige.ch/ico/navi/tex2html/top.gifhttp://tecfa.unige.ch/ico/icons/vrml97-icon.gif next up previous contents index
Next: 7.2 Building a mini Up: 7. Animation and Avatars Previous: 7. Animation and Avatars

   
7.1 Introduction to keyframe animation

VRML provides a set of tools for keyframe animations. An animation sequence can be understood as a cycle with a beginning (the first frame) and and end (the last frame) and everything in between. In order to build keyframe animations you define a set of so-called keyframes, i.e. specific critical moments in an animation cycle.

You then use interpolator nodes (or custom made script nodes) to compute all the intermediary positions that are necessary for a smooth animation in function of the fraction of the animation cycle computed. Practically this means that you use the output of the fraction_changed filed of =>TimeSensor as input for an interpolator engine. Note that the length of the animation is just defined by the TimeSensor's cycleTime field. In section 5.2 we gave a short introduction to this technique.

Keyframes are usually (and simply put) virtual definitions of some VRML geometry that you want to animate, e.g. position, shape, color of some group of objects. But you can ``animate'' whatever exposed fields or eventIns of any node you wish.

There exist a variety of builtin =>Interpolator nodes that cover some common linear animations needs:

1.
The => ColorInterpolator

2.
The => CoordinateInterpolator

3.
The => NormalInterpolator

4.
The => OrientationInterpolator

5.
The => PositionInterpolator

6.
The => ScalarInterpolator

All these interpolators work the same way, i.e. they share a common set of fields:

   eventIn      SFFloat      set_fraction
   exposedField MFFloat      key           [...]
   exposedField MF<type>     keyValue      [...]
   eventOut     [S|M]F<type> value_changed

The set_fraction eventIn receives an SFFload event that can be any kind of floating point number. In practise it is usually a number between 0 and 1 produced by a TimeSensor's fraction_changed field. Now, for each ``critical'' fraction of the whole animation cycle you add the fraction to the array of keys and for each key you must specify a interpolator-specific keyValue. Finally, the interpolator will produce the interpolated value_changed eventOuts (as many as your implementation can handle).

The principle of keyframe animation is very simple. What is not so simple are for example:

[ ... more to come]


next up previous contents index http://tecfa.unige.ch/ico/navi/tex2html/top.gifhttp://tecfa.unige.ch/ico/icons/vrml97-icon.gif
Next: 7.2 Building a mini Up: 7. Animation and Avatars Previous: 7. Animation and Avatars
D.K.S. - 1998-03-18