MEL How-To #31

Back · Previous · Next Maya

How can I mirror the keys on an animCurve so the animation plays backwards?

Select one or more fcurves in the Graph Editor.

Enter the following command:

scaleKey -timeScale -1.0

Move the beginning of the fcurve(s) back to their respective places (use Maya's SHIFT-key gesture feature to move on time but not value).

With a bit more work, and a few ‘keyframe -query’ commands, you can parse out the range of keyframes in an fcurve, find the "time center" and pivot the scale at the center of the fcurve. For example, if an fcurve was animated in the time range "0:100", pivot it at time 50 for a true mirror fcurve:

scaleKey -timeScale -1.0 -timePivot 50