Copy link to clipboard
Copied
I'm having a hard time figuring this one out. I don't see anything in the manual or anywhere that I can find online, but it is a tough one to search for.
I've got an expression driven position property in a project that's giving me green values in the composition panel. The values count up and appear as though they're evaluating a "for" loop that I've got in the expression. While the numbers are green, it locks up the expression and I'm not able to edit the property in any way until the green numbers hit the "target" value, and then the numbers go back to red. This takes about twenty seconds every time I move the playhead. However, if I just RAM preview the timeline, the expression seems to evaluate extremely quickly, less than a second per frame.
What these values look like:
The expression:
x = 960;
y = 0;
searchLayer = thisComp.layer("EKG Precomp");
lumaTolerance = 0.9;
searchRadius = [1, 1];
for (i = 10; i < thisComp.height; i++){
lumaLookup = searchLayer.sampleImage([959, i], searchRadius, false, time);
if (lumaLookup[0] < lumaTolerance){
y = i;
break;
}
}
y += (content("Ellipse 1").content("Ellipse Path 1").size[1] / 2);
[x, y]
I know that this code isn't super clean or efficient; it's just a proof of concept for a friend.
What do these green values refer to?
Copy link to clipboard
Copied
I think the green represents a problem with a recursive loop. That would explain why moving the CTI one frame takes 20 seconds.
What exactly are you trying to do? As far as I can tell you are trying to sample another layer but I don't see anything that turns the array that sampleImage() delivers into luminance. The array delivered by the code is [Red, Green, Blue, Alpha] with a value range between zero and one.
I'd have to play with the code, but it would help me to help you if I knew what you were trying to do in plain English.
Copy link to clipboard
Copied
The whole project is black and white so, as a shortcut (like I said, the code isn't very organized), I just take the red value of that sampleImage() and compare it to a threshold for the luminance. Basically, all this code does is find the uppermost non-white pixel at a specific X value and returns that Y value to the position.
But this is the strange thing - my code does exactly what I want it to do and renders and RAM previews quickly without any issues. It's only slow when I go over a random frame that's not already in the cache and I get the green values like above.