Mapping Value Ranges


click to expand

Say you want a layer to rotate one time around as it travels from left to right, all the way across the comp. In this case, rotation values will run from zero to 360 degrees.

Assuming this is a 4:3 NTSC comp, X position values will run from zero to 720. If you simply add an expression to Rotation and Pickwhip position, you won't get what you want, because when the layer is at 720, it will also be rotated to 720 degrees, which is double the amount you intended.

The following expression will take the Position range-zero to 720-and map it to the Rotation range-zero to 360-so when the layer is positioned at 720, its rotation will only be 360.

 controllerMin = 0; controllerMax =720; controlledMin = 0; controlledMax = 360; 

linear(position[0],controllerMin,controllerMax,controlledMin,controlledMax);

To add this expression, Option click (Alt click) the Rotation stopwatch, delete the default expression (rotation), and hand type the new one, pressing Return (Enter) after each line. Click Enter on the numeric keypad when you're finished.

If you change the position animation so that the layer ends at 500x (but still want the layer to rotate one time around), change the second line of the expression to controllerMax = 500;




After Effects On the Spot[c] Time-Saving Tips and Shortcuts from the Pros
After Effects On the Spot[c] Time-Saving Tips and Shortcuts from the Pros
ISBN: 1578202396
EAN: N/A
Year: 2006
Pages: 447

flylib.com © 2008-2017.
If you may any questions please contact us: flylib@qtcs.net