5.2. Time Sources

By default, a newly-created K-3D document contains an instance of the TimeSource plugin. TimeSource provides storage for several time-related parameters:

Time-varying behavior is introduced into a document by connecting the TimeSource “time” property to input properties on other nodes using the Visualization Pipeline. Since “time” is a k3d::double_t, it can be connected directly to any other k3d::double_t property. For example, the following pipeline connects the radius of a Sphere to the current time:

edf08405-7911-4218-876e-646503ba5f08.png

In this scenario, the radius of the sphere will always be equal to the current time. If an animation is rendered from time t = 0 to t = 4, the radius of the sphere will smoothly change from 0 to 4 over the course of the animation.

Of course, you may add nodes to the pipeline to manipulate the time value prior to use. For example, you might want the Sphere radius to change at a different rate than time:

2318eb76-ed7b-4b40-ac6a-5876a287c349.png

Here, the ScalarMultiply node applies a scaling factor to the current time value before it’s used by the Sphere. Many other plugins are available to manipulate scalars - for example you might combine ScalarAdd to offset time, ScalarModulo and ScalarSine to provide repetitive behavior, and ScalarSourceScript for fully-generic scripted behavior.

5.2.1. Notes

  • Although it’s possible to add more-than-one TimeSource to a document, the graphical user interface will only manipulate one of them.
  • The start_time, end_time, and frame_rate properties will likely be moved out of TimeSource at some point, since it is reasonable to want to render multiple animations from a single document (e.g: to render the animation at different frame rates for different target media).