Select
Function
This powerful function allows you to construct different compositing branches
and choose between them based on an arbitrary rule you create. This rule
can be an animated curve, a rule based on time, a rule based on a node's
parameter, or anything else you might want to do.
Example
This tree has two input images, Asteroid and Earth.
We want the Earth to orbit around the asteroid. We animate it with the
Move2D, and then plug both into 2 Over commands, switching
foreground elements for each. The Select function then picks one
of the Over commands, based on time to make it look like the Earth
is orbiting around the Asteroid. The branch expression says "if the
current frame is greater than 14 and less than 32, then use OverA,
otherwise, use OverB". You can also just animate the branch
number by hand. This is only us being clever. You can, of course, just
animate the branch with a curve...
|
Select statement:
time>14&&time<32?1:2
|
Earth,
Asteroid
|
 |
 |
|
 |
|
Select1,
frame 5,
frame 20
|
 |
|
Parameters
|
Type
|
Default
|
Function
|
branch |
int
|
1
|
The expression to pick a branch. If the
expression equals 1, then the first branch is used, if it equals 2,
the second branch is used, etc. |
Synopsis
image Select(
int branch,
image,
image,
image,
image
);
Script
image = Select( branch, image, image, image, image);
Command Line
shake -select branch image image image image
|