-
Odd/Even Markers
Is there a way to distinguish odd and even numbered markers?
I trying to do a cascading text like in Stranger Than Fiction. I keyframes a #D text layer’s x orientation to flop the text, then moving the anchor point, flopping again, and the text cascades down the screen. There is a pause of time so the text pause after each flop, so that I can apply the following dampening expression to X Rotation.
amp=70; //amplitude (pixels)
freq=2; //frequency (cycles per second)
decay=2.5; //decay time (seconds)// find previous marker
n = 0; // assume haven’t reached a marker yet
if (marker.numKeys > 0){
n = marker.nearestKey(time).index;
if (marker.key(n).time > time){
n–;
}
}if (n > 0) t = time – marker.key(n).time else t =0;
a = amp*Math.sin(freq*t*Math.PI*2)/Math.exp(decay*t);
aIf I could have the last line be “a” on odd numbered markers, and be “- a” on even numbered markers, the dampening would look right. With only “a” as the last line, the text always kicks out in the same direction, and I want it to kick out first toward the viewer, then on the next marker kick out away from the viewer.
Can expression differentiate odd or even numbered markers?