Connect attributes with an expression

To connect the value of one attribute to another with an expression

  1. In the Attribute Editor, type an equals sign (=) followed by a MEL expression in the attribute’s text box.

    or

    Select the node with the attribute you want to edit and select Windows > Animation Editors > Expression Editor. Click the attribute and type a MEL expression in the box at the bottom.

For example, to make the translateX value of pTorus1 always equal the translateY value of pCone2, type =pCone2.translateY in pTorus1’s translateX box. When you move the cone up and down in Y, the torus moves side-to-side in X.

You can create more complex expressions using multiple attributes and MEL’s math functions.

When you type an expression into a text box in the Attribute Editor or Channel Box and press Enter, Maya shows the computed value with a purple background. You cannot edit values that are the result of an expression. To edit the expression, use the Expression Editor.

Related topics