Apple Shake 4 User Manual

Page 275

Advertising
background image

Chapter 8

Using the Time View

275

Finally, calculate the resolution of the RGrad by comparing the two input sizes. The
script should now look like this:

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,
min(width,height)/4, //This is the radius
min(width,height)/4, //This is the falloff
0.5, 1, 1, 1, 1, 0, 0, 0, 0, 0, 0);

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

}

5

The maximum distance to expand the RGrad can be calculated by measuring the
distance from the center to a corner, which can be done with the distance() function.
(For more information, see Chapter 31, “Expressions and Scripting,” on page 935.) Once
this is calculated, multiply it by the mixPercent. Also, plug the blur value into the falloff
parameter, with a check on the radius to see if falloff should equal 0 when radius
equals 0. Also, add the command to load it as a mixer in the Transition node:

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,
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, 0);

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

Advertising