-
Trigger composition start on Controller position – Code tidy-up
Hi everyone,
I’ve currently got a working composition and it has the functionality I would like however it is rendering exceedingly slow and I am struggling to find a better way of coding the expressions so it doesn’t run so slowly.
I have time remap key frames on the playing compositions and have placed the expression on that, I also have a null that acts as the controller so once that null passes a certain x point it triggers the composition to play. The play composition is a simple solid that scales and has a bounce on it, this play comp is then duplicated numerous times and spread out along the x axis to form a ruler.
The entire composition acts as ruler marks that stretch to measure certain things so I’ve created it this way to enable the easy editing of the ruler length so needs to retain the same functionality and not trigger at the start. The entire project will be used multiple times and by various people so I need it to be easy to edit.
I’ve looked into ‘index’ but don’t want to use time as a variable as the entire piece will be different timings each time it is used. There might be a way of using index but I’m reaching the limits of my knowledge.
I hope I’ve explained it okay and any thoughts on how to speed it up would be greatly appreciated.
“< (less than) symbol isn’t appearing in the expression below but it is where (& l t 😉 is”
Here is the project files to have a look at:
Cheers,
Andyrange = 20;
point2 = thisComp.layer("[Control]").transform.position;
point1 = transform.position;
above = false;for (f = timeToFrames(inPoint);
f <= timeToFrames(); f++){
t = framesToTime(f);
distance = length(point1.valueAtTime(t),point2.valueAtTime(t));
if (distance <= range ){ above = true; break;
}
} if (above) time - t else 0;