r>120?200:80
g>120?200:80
b>120?200:80
See? The
question "Is the red value greater than 120?" is expressed
"r>120?" Then you just put in your "then"
and "if not then" results. If it is, then change it
to 200. If it isn't, change it to 80. This is simply expressed
"200:80." Try this out just to see what happens.
Well, the
problem is that this is just a one-trick effect. So, instead,
let's use some controls to add a little flexibility. Instead
of 120, 200 and 80, use ctl(0), ctl(1) and ctl(2). So you will
have:
r>ctl(0)?ctl(1):ctl(2)
g>ctl(2)?ctl(3):ctl(4)
b>ctl(4)?ctl(5):ctl(6)
So, if the
value of red is greater than the value of the first slider (ctl(0)),
then change it to the value of the second slider(ctl(1)). Otherwise,
change it to the third slider (ctl(2)). The kinds of effects
you can get from this are pretty slick. Still, you do feel a
bit confined by such a small formula, don't you?
No, of course
not. You're the adventurous sort. You won't just settle for
ctl(1). You want to try sin(ctl(1)). Well, go for it, tiger.
Try this one out:
r>ctl(0)?sin(ctl(1)):sin(ctl(2))
g>ctl(2)?sin(ctl(3)):sin(ctl(4))
b>ctl(4)?sin(ctl(5)):sin(ctl(6))
Three
methods of handling if/then/else statements:
a fixed number (top), a slider variable (middle) and
the sine of a slider variable (bottom).
It just
gets more and more bizarre, doesn't it? Well, let's try adding
in a little convolution to make things a little more crazy.
If r is greater than ctl(0), then convolve it one way. If not,
convolve it another. You can try any old way of convolving it
you feel like trying. I'm going to try this one:
r>ctl(0)?cnv(ctl(0),ctl(0),ctl(0),ctl(0),ctl(0),ctl(0),ctl(0),ctl(0),ctl(0),ctl(6))
:cnv(ctl(1),ctl(1),ctl(1),ctl(1),ctl(1),ctl(1),ctl(1),ctl(1),ctl(1),ctl(7))
