-
Starting a cumulative expression based on a condition
Hey guys,
I’m trying to get a cumulative expression to start when the position of another layer crosses its Y-Position value. In this case, start pushing layer2’s X-Position once layer1’s Y-Position passes it.Here’s what I have:
track = thisComp.layer(“layer1”).transform.position;
pos = transform.position;
accum = 0;for(i=timeToFrames(inPoint);i<=timeToFrames(time);i++){
if (track.valueAtTime(i)[1]<=pos[1]){
accum += 0;
}else{
accum += 10;
}
}value + [accum,0];
I can’t for the life of me figure out why this code doesn’t work. It seems to ignore the IF statement and accumulate from the very start.
It isn’t for anything in particular, I’m just trying to get it to work as a concept.
Any help would be greatly appreciated.