Tweens and Tween Operations

Every tween operation is based on a collection of one or more values from which a range of output values can be algorithmically derived. Each tween is assigned a time duration, and an output value can be generated for any time value within the duration. In the simplest kind of tween operation, a pair of values is provided as input and values between the two values are generated as output.

For example, if the tween data is a pair of integers, 0 and 5, the duration of the tween operation is 100, and the algorithm used to generate output values is linear interpolation (in which generated values, when graphed, fall on a straight line between the input values), the output returned for a time value of 0 is 0, the output for 25 is 1.25, the output for 50 is 2.5, and the output for 100 is 5.

QuickTime supports a variety of tween types. Each tween type is distinguished from other types by these characteristics:

Tween operations for each tween type are performed by a tween component that is specific to that type or, for a number of tween types that are native to QuickTime, by QuickTime itself. Movies and applications that use tweens do not need to specify the tween component to use; QuickTime identifies a tween type by its tween type identifier and automatically routes its data to the correct tween component or to QuickTime. If you need to perform tween operations that QuickTime does not support, you can develop a new tween component, as described in Creating a Tween Component.

When a movie contains a tween track, the tween media handler invokes the necessary component (or built-in QuickTime code) for tween operations and delivers the results to another media handler. The receiving media handler can then use the values it receives to modify its playback. For example, the data in a tween track can be used to alter the volume of a sound track.

Tweens can also be used outside of movies by applications or other software that can use the values they generate.

Tween Types

Each of the tween types supported by QuickTime belongs to one of these categories:

Single Tweens and Tween Sequences

A tween operation can include one or more tweens. A tween operation that includes just one tween is called a single tween. For a single tween, results for any time points in the tween duration are derived from that tween. A tween sequence contains more than one tween of the same type. To specify when each tween is used, you specify an ending percentage for each tween. For example, if you have a tween sequence containing three tweens and want to use the first tween for the first quarter of the tween duration, the second tween for the second quarter of the tween duration, and the third tween for the remainder of the tween duration, you set the end percentage for the first tween to .25, for the second to .5, and for the third to 1.0. The first tween in the sequence always begins at the beginning, and each subsequent tween begins after the end percentage of the tween before it.

Interpolation Tweens

Interpolation tweens are tweens that modify other tweens. The output of an interpolation tween must be a time value, and the time values generated are used in place of the input time values of the tween being modified. For example, you can use a path tween whose data specifies a curve to modify a tween that uses linear interpolation for its algorithm. The starting and ending values for the modified tween remain the same, but the rate at which output values change over time is determined by the shape of the curve.

Once you create an interpolation tween, you can use it to modify any number of other tweens. You can do this by specifying maximum and/or minimum output values of the interpolation tween to match the time values for the tween to be modified. For example, if there is a curve whose shape describes the natural decay rate for several different sounds, you can can define a single interpolation tween for that curve and apply it, with appropriate maximum and minimum values, to all of the sounds.

An interpolation tween can modify another interpolation tween; the only requirement is that the output of each interpolation tween must be a time value. The ability to define series of interpolations makes it possible to create libraries of standard modifications that can be used together to generate more complex transformations.