This function re-orders the layer stack using either a builtin function (only reversal is available at the moment, contact me if you find another useful function) or a custom one.
REVERSE (1) will reverse the order of layers (it is equivalent to the custom function
SHIFT (2) will shift the sequence by the amount (positive or negative) indicated in the custom field.
It is equivalent to the custom function
( i + custom ) % n.
If you specify CUSTOM (0) as function than you can use the "custom" argument to specify any function you like.
i is replaced by the index of the layer (
n is replaced by the total number of layers.
The function returns the new position of the layer,
which is measured relative to all other positions,
your function can return values 0.1,
0.7 and 0.3 for layers 0,
1 and 2 respectively,
and the new order will be 0,
2 and 1.
-i # reverse the order of layers (i+5)%n # shift the order of frames by 5