[Up] [Next]

10.1.1 ElapsedTime Engines

ElapsedTime engines are very simple animation engines. They have an input field named timeIn and an output field named timeOut. There is also a speed field that you can use to control the rate of output. Typically speed has values between 0.0 and 2.0, with 1.0 being the default, with larger numbers resulting in faster output. Negative values can be used to reverse the direction of the engine. You connect some field to timeIn so that when it changes, timeOut will also change. Since the purpose of ElapsedTime engines is to indicate the amount of time that has passed since they started running, the simplest and most obvious field connection to make is to connect the global field realTime to timeIn to drive an ElapsedTime engine by the changes in the built-in computer clock. For this reason, by default realTime is always connected to timeIn unless you specify otherwise.

Example

Here is a very simple example where the angle of a rotation transformation is controlled by the output of ElapsedTime. The rotation is about the X axis.

    RotationXYZ {
      axis    X
      angle     =
        ElapsedTime {
          speed 0.5
        }
        . timeOut
    }

To make the idea of connecting something to the input field timeIn more obvious, here is an example that would have the same effect as the one above, since by default realTime is connected to timeIn:

    RotationXYZ {
      axis    X
      angle     =
        ElapsedTime {
          timeIn =
            GlobalField {
              type    "SFTime"
              realTime 0
            }
            . realTime
          speed 0.5
        }
        . timeOut
    }

Here is a complete Inventor .iv file that would display a quickly rotating cone about the Z axis. Just cut and paste the text into a file named test.iv and then do ivview -q test.iv:

    #Inventor V2.0 ascii

    Separator {
      RotationXYZ {
	axis	Z
	angle	  =
	  ElapsedTime {
	    speed 2.0
	  }
	  . timeOut
      }
      Cone {
      }
    }

MIT home page HTML written and maintained by Reid M. Pinchback (reidmp@mit.edu)
Last modified 96/06/11; copyright © 1996 MIT