decorative banner

Using the Layer, Property, and Channel menus (PB only)


    To allow easy substitution of different layers and parameters into Motion Math scripts, use the Layer, Property, and Channel menus to select layers, properties, or channels, and then run the script on the selected elements. In this way, you can quickly run a script on different layers or compositions.

    To write a script that uses these menus, include one or more of the substitution functions:

    • The pop_layer () function obtains the current selection from the specified Layer menu.
    • The pop_property () function obtains the current selection from the specified Property menu.
    • The pop_channel () obtains the current selection from the specified Channel menu.

    For each function, you must specify which of the two sets of menus to use. Type a 1 in the parentheses to specify a menu in the first set; type a 2 in the parentheses to specify a menu in the second set. Your script need not use all six menus; any selections in the unused menus are ignored. In general, substitution functions are used inside other functions that require layers, properties, or channels as variables, such as the value () or velocity () functions. For example, the following line uses the pop_layer () function inside the value () function:

    delta = value(pop_layer(1),position) - value(pop_layer(2),position);

    The line above obtains the position value for the layer selected in the first Layer menu and subtracts the position value for the layer selected in the second Layer menu. You can also use a substitution function on the left side of an assignment when creating a keyframe. In the following example, a rotation keyframe is created for the layer selected in the first Layer menu:

    value(pop_layer(1), rotation) = ang;

    Use the substitution functions to select properties and channels in up to two layers. Both sets of menus list layers, properties, or channels, as follows:

    • The Layer menus list all available layers in the composition.
    • The Property menus list the properties available for the layer selected in the corresponding Layer menu.
    • The Channel menus list the channels available for the property selected in the corresponding Property menu.

    If you need to select a third layer, you can create a variable in the script where you type the name of the layer. For an example, see the Span script.