Apple Shake 4 User Manual

Page 276

Advertising
background image

276

Chapter 8

Using the Time View

6

Now comes the tricky bit—reversing the mix. You may think multiplying by -1 inverts
the transformation, but you’d be wrong. Instead, you often have to subtract the value
from the maximum value that you expect, in this case the distance from the center to
the corner. This is part of a conditional statement that tests to see if reverse is activated.
Also, invert the mask in the KeyMix to help it out.

image RadialWipe(

image in1=0,
image in2=0,
float blur=0,
int reverse=0,
float mixPercent=“HermiteV(x,1,[0,50,50]@0,[100,50,50]@100)”

)
{

RGrad1 = RGrad(

max(in1.width,in2.width),
max(in1.height,in2.height),
1, width/2, height/2, 1,
reverse?distance(0,0,width/2,height/2)-

mixPercent*distance(0,0,width/2,height/2)/100:

mixPercent*distance(0,0,width/2,height/2)/100,
radius==0?0:blur,
0.5, 1, 1, 1, 1, 0, 0, 0, 0, 0, 0);

return KeyMix(in1, in2, RGrad1, 1, “A”, 100, reverse);

}
nfxDefMixer(“radialWipe”, “RadialWipe()”);

7

Save all of this as a .h file in your startup directory.

8

As a final touch, open a ui .h file and add an on/off button for the reverse parameter:

nuxDefExprToggle(“RadialWipe.reverse”);

Now when you launch Shake, a new mixer in Transition is available for you to use.

Advertising