Apple Developer Connection
Member Login Log In | Not a Member? Contact ADC

< Previous PageNext Page > Hide TOC

Tween Media

Tween media is used to store pairs of values to be interpolated between in QuickTime movies. These interpolated values modify the playback of other media types by using track references and track input maps. For example, a tween media could generate gradually changing relative volume levels to cause an audio track to fade out. It has a media type of 'twen'.

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.

A tween track is a special track in a movie that is used exclusively as a modifier track. The data it contains, known as tween data, is used to generate values that modify the playback of other tracks, usually by interpolating values. The tween media handler sends these values to other media handlers; it never presents data.

In this section:

Tween Sample Description
Tween Sample Data
Tween Type Categories
Tween QT Atom Container


Tween Sample Description

The tween sample description uses the standard sample description header, as described in “Sample Table Atoms.”

The data format field in the sample description is always set to 'twen'. The tween media handler adds no additional fields to the sample description.

Tween Sample Data

Tween sample data is stored in QT atom structures.

At the root level, there are one or more tween entry atoms; these atoms have an atom type value of 'twen'. Each tween entry atom completely describes one interpolation operation. These atoms should be consecutively numbered starting at 1, using the atom ID field.

Each tween entry atom contains several more atoms that describe how to perform the interpolation. The atom ID field in each of these atoms must be set to 1.

Table 3-11 shows all currently defined tween types. All tween types are currently supported using linear interpolation.

Table 3-11  Tween type values

Tween type

Value

Tween data

16-bit integer

1

Two 16-bit integers.

32-bit integer

2

Two 32-bit integers.

32-bit fixed-point

3

Two 32-bit fixed-point numbers.

Point: two 16-bit integers

4

Two points.

Rectangle: four 16-bit integers

5

Two rectangles.

QuickDraw region

6

Two rectangles and a region. The tween entry atom must contain a 'qdrg' atom with an atom ID value of 1. The region is transformed through the resulting matrices.

Matrix

7

Two matrices.

RGB color: three 16-bit integers

8

Two RGB colors.

Graphics mode with RGB color

9

Two graphics modes with RGB color. Only the RGB color is interpolated. The graphics modes must be the same.

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 tweening 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.

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.

Tweening can also be used outside of movies by applications or other software that can use the values it generates.

Tween Type Categories

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

Tween QT Atom Container

The characteristics of a tween are specified by the atoms in a tween QT atom container.

A tween QT atom container can contain the atoms described in the following sections.

General Tween Atoms

Path Tween Atoms
List Tween Atoms
3D Tween Atoms
Interpolation Tween Atoms
Region Tween Atoms
Sequence Tween Atoms
endPercent

A value of type Fixed that specifies the point in the duration of the tween media sample at which the sequence entry ends. This is expressed as a percentage; for example, if the value is 75.0, the sequence entry ends after three-quarters of the total duration of the tween media sample have elapsed. The sequence entry begins after the end of the previous sequence entry or, for the first entry in the sequence, at the beginning of the tween media sample.

tweenAtomID

A value of type QTAtomID that specifies the kTweenEntry atom containing the tween for the sequence element. The kTweenEntry atom and the kTweenSequenceElement atom must both be a child atoms of the same tween QT atom container.

dataAtomID

A value of type QTAtomID that specifies the kTweenData atom containing the data for the tween. This atom must be a child atom of the atom specified by the tweenAtomID field.



< Previous PageNext Page > Hide TOC


Last updated: 2007-09-04




Did this document help you?
Yes: Tell us what works for you.

It’s good, but: Report typos, inaccuracies, and so forth.

It wasn’t helpful: Tell us what would have helped.
Get information on Apple products.
Visit the Apple Store online or at retail locations.
1-800-MY-APPLE

Copyright © 2007 Apple Inc.
All rights reserved. | Terms of use | Privacy Notice