Loops (PB only)Although Motion Math runs a script using a built-in loop specified by the sampling rate, you can also include loops inside scripts, using the following format: while (expression) { statement; } Statements contained inside the braces are repeatedly evaluated until the expression is no longer true. In the following example, the loop cycles through each layer in the composition, creating a scale keyframe with a value of 35: n = 1; while (n <= num_layers) { value(n, scale) = 35; n = n+1; } To prevent infinite loops, Motion Math stops a loop after 32,000 cycles. You can also stop a loop by pressing the Escape key (Windows) or both the Command and . (period) keys (Mac OS) while the script is running. |