OK. So I've read Dan Ebberts's helpful explanation at
http://forums.creativecow.net/readpost/227/11461, and if I have a text layer with an animated position, to which I add an expression selector (and get the default
selectorValue * textIndex/textTotal expression) this works fine, as expected. What I'm trying to do is have the text sort of drop in from above/below, overshoot, swing back, overshoot again... as if it's on a rubber band. It would eventually come to a halt. Harry J Frank's graymachine.com contains an expression to do this on something else, the nuts and bolts of which are
offset = (amp * Math.sin(freq*t*2*Math.PI)/Math.exp(t*decay));
// amp = amplitude, freq = frequency, t = time
So, combining the two (I freely admit I still don't fully understand expression selectors) I get
amp = 100;
decay = 1.5;
reps = 8;
freq = 3;
pc = selectorValue * textIndex/textTotal; // percentage you want to scale this effect by
o = text.animator("Animator 1").selector("Range Selector 1").offset;
// this is keyed between 0 and 100% with another 100% key later on to act as a "stop wobbling" indicator
if ((time - o.key(2).time)*freq*pc >= reps) {
t = 0;
} else {
t = (time - o.key(2).time) * pc;
}
wibble = (amp * Math.sin(freq*t*2*Math.PI)/Math.exp(t*decay));
if (time >= o.key(2).time) {
wibble
} else {
100
}
What happens is I get "invalid numeric result (divide by zero?)" at line 0 whenever I try to look at the layer. I can't work out why, but by eliminating the code line by line it seems to be to do with the selectorValue * textIndex/textTotal bit. If I leave this out, it's fine (but obviously nothing happens). Can anyone help?