-
Super weird expression oddity
I’m creating a mogrt which is essentially a jazzed up box with some text on it. Somehow this behemoth now has over 40 controls on it for things like where the box is, how long the text stays on screen etc. One of the controls gives the size of the main text body (which can have up to 8 lines), and I just need it to give the maximum size of that block; I can’t use sourceRectAtTime() because each line can have a different size, so it’s only clear how big the whole thing is once all the different sizes are taken into account.
Thing is, that applying this expression to the control freaks the entire thing out. You can see what’s happening here:
https://vimeo.com/804372040/83cf468554
It’s not that the expression is returning a different pair of values than are currently hard-coded into the point control – I’ve set them to be the same, for this text layout. It’s just that for some reason, applying this expression causes everything to go weird. I’ve rewritten it a couple of times, and checked there’s no accidental recursion or anything. Deleted cache, restarted AE etc etc. I can’t work it out – any ideas?
The code is:n = effect("numLines")("Slider"); // gives how many actual lines of text there are
minx = miny = 10000;
maxx = maxy = 0;
tl = br = [];
for (i = 1; i <= n; i++) {
L = thisComp.layer("Line " + i); // text lines are called Line 1, Line 2, etc.
/*
// each text layer has a top left / bottom right
// point control worked out with sourceRectAtTime(time, true)
*/
tl = L.effect("tl")("Point");
br = L.effect("br")("Point");
if (tl[0] < minx) minx = tl[0];
if (tl[1] < miny) miny = tl[1];
if (br[0] > maxx) maxx = br[0];
if (br[1] > maxy) maxy = br[1];
}
[maxx-minx, maxy-miny]Some contents or functionalities here are not available due to your cookie preferences!This happens because the functionality/content marked as “Vimeo framework” uses cookies that you choosed to keep disabled. In order to view this content or use this functionality, please enable cookies: click here to open your cookie preferences.