Expressions are instructions you give Maya to control attributes over time. An attribute is a characteristic of an object, for instance, X scale, Y translate, visibility, and so on.
Though you can create an expression to animate attributes for any purpose, they’re ideal for attributes that change incrementally, randomly, or rhythmically over time.
Expressions are also useful for linking attributes between different objects—where a change in one attribute alters the behavior of the other. For instance, you can make the rotation of a tire dependent on the forward or backward movement of a car.
Expressions offer an alternative to difficult keyframing tasks. In keyframing, you set the values of attributes at selected keyframes in the animation, and Maya interpolates the action between the keyframes. With expressions, you write a formula, then Maya performs the action as the animation plays.
Expressions are often as simple as a few words or lines. In the following example expressions, note the variation in length and detail (rather than their purpose).
Ball.translateX = Cube.translateX + 4;
if (frame == 1) Cone.scaleY = 1; else { Cone.scaleY = (0.25 + sin(time)) * 3; print(Cone.scaleY + "\n"); }
You can use an expression to animate any keyable, unlocked object attribute for any frame range. You can also use an expression to control per particle or per object attributes. Per particle attributes control each particle of a particle object individually. Per object attributes control all particles of a particle object collectively.