Hey again, Filip! I ran into this little issue with the code, and I was wondering if perhaps you’d be able to give me a hand on it.
Literally all I’m trying to do is split the selection into 2 equal parts now, each doing the same, so the pseudo matte I’m working with follows the stacked text’s position.
Quick explanation: My text consists of 2 “layers”. First, there are x lines of text, followed by the same amount of lines with the “|” character, which is then layered onto the text with a position animator, stretched out with a scale animator, and finally filled with a color to create the pseudo matte which you can see in my previous video.
So far, I’ve managed to band-aid the code, so it only applies for the first half and remains static for the other, which looks like this:
const flip = effect("Flip")("Checkbox");
const stggr = effect("Stagger")("Slider");
const tot = textTotal-1;
const ind = textIndex-1;
const range = textTotal/4;
const offst = range - ind;
const rO = offst/range;
const mod = Math.cos(Math.PI*2-.25+rO*2) + 1;
let sel1 = linear(textIndex, 1, textTotal/2, -100, 100); //0-50% selection
sel = textIndex > textTotal/4 && flip == 1 ? sel1 : -sel1;
//let sel2 = linear(textIndex, textTotal/2, textTotal, -100, 100);
if(stggr <= 0) {
easeL = sel * mod/2;
v = ease(stggr, -100, 0, easeL, sel);
} else if(stggr >= 0) {
easeH = sel / mod/2;
v = ease(stggr, 0, 100, sel, easeH);
}
const pos = effect("XYZ")("3D Point");
const delaySldr = effect("Time Delay")("Slider");
const delay = effect("Time Delay")("Slider").value * thisComp.frameDuration;
let p = ind < range ?
pos.valueAtTime(time + delay*ind)
:
pos.valueAtTime(time + delay*(Math.round((tot/2)-ind-1)));
textIndex <= textTotal/2 ? p*v/10000 : 0
…but obviously that’s just a substitute.
I’ve tried overly complicated if else’s and a bunch of other stuff I can’t even remember anymore, but either the whole distribution was distorted or the timing of the delay didn’t match between the two halves… Maybe you know an elegant fix for this, or can explain to me how to split a slightly more complex text selection like this into multiple segments?