## Welcome to the Community!

We have a brand new look! Take a tour with us and explore the latest updates on Adobe Support Community.

• Green Values in the Composition Panel?

# Green Values in the Composition Panel?

Community Beginner ,
Aug 09, 2021 Aug 09, 2021

Copied

I have added an expression to a value in my composition panel. Instead of the expected red numbers, I'm getting green numbers that evaluate over time, and turn red once they find the expected value. However, if I RAM preview the comp, everything calculates much quicker than if I do a frame at a time. I should mention that the expression works as expected with no issues.

Does anyone know what these green values represent?

For reference, the expression in question is:

``````x = 960;
y = 0;
searchLayer = thisComp.layer("EKG Precomp");
lumaTolerance = 0.9;
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 it's rough and inefficient; it was just a quick proof of concept for a coworker. It sets a layer's Y value based on the highest black pixel in a column of pixels in another layer.

TOPICS
Expressions, User interface or workspaces

Views

102

Likes

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
13 Replies 13
Aug 09, 2021 Aug 09, 2021

Copied

Already answered in your previous thread. You have a recursive loop. The green numbers tell you that the frame is trying to make the calculations and it's just not done yet. It's the look back again and again for a sample image value chat that causes the problem. Your expression does not contain javascript errors, it's just recursive. Look here, does it match, no, look somewhere else, does it match, no, look somewhere else, does it match, no until if finds a yes. It does that on every frame and once in a while it just hangs up. That's the problem. It may render OK, or in some cases, the render may hang forever.

You need to redesign the expression. I'm not sure how to do it in the most efficient way but I would probably do it in a different way. I would probably use the values that are driving the EKG pre-comp that you are looking at. It could be as simple as a simple linear(t, tMin, tMax, value1, value2) interpolation method.

Likes

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
Community Beginner ,
Aug 09, 2021 Aug 09, 2021

Copied

I'm not looking for help with the expression; it was just a proof of concept that I used to demonstrate a point to a coworker. I'm interested in this green value UI feature that I've not seen before.

Do you know anything more about the specifics of what the green indicates? I ask because the whole project previews extremely quickly; I only get sluggishness when going to a random frame. Also, I've had loops in expressions before and haven't had green values. Is it a new UI feature?

Maybe green values indicate a loop that takes more than a pre-determined amount of time? I assume that it's sluggish in its calculation on a frame only because it's limiting the amount of calculations that an expression can evaluate, per frame, while not rendering. This would also explain why it runs slow on random frames, but not during render. However, this is pure speculation; I'm just trying to make sense of what I'm experiencing.

I wish that there was information in the manual on this specific item. I'm just trying to understand the software as best I can so that I can make efficient tools going forward and it's somewhat frustrating that I can't find any official documentation about this UI element.

Likes

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
Aug 09, 2021 Aug 09, 2021

Copied

When you pick a random frame it has to start at the first frame and start calculating. That's the problem with recursive expressions. You're just waiting for every previous frame in the composition to calculate the position of the transition.

Likes

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
Community Beginner ,
Aug 10, 2021 Aug 10, 2021

Copied

That makes sense, and I've considered this, but it takes a long time to calculate even if it's the first frame of the composition. And, based on my knowledge, these methods I'm using should be independent of the expression's value on previous frames. Of course, there's always a chance that Adobe's expression language is written in an inefficient way, but their documentation isn't very in-depth. Perhaps sampleImage() is what's causing the extra calculations?

Likes

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
Aug 10, 2021 Aug 10, 2021

Copied

It is more "look here, can't find it, look somewhere else until you find it" than it is sourceRectAtTime().

I've still never seen your composition but I would be using whatever is driving the EKG layer directly with a linear interpolation if necessary.

Likes

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
Community Beginner ,
Aug 10, 2021 Aug 10, 2021

Copied

As I've said before, I don't need help with the expression, as it was just a proof of concept and is somewhat irrelevant to this post. I just included it so that people could see what might be causing the green values. I'm just trying to learn more about how AE works and why these green values are appearing / what they mean. I want to learn everything I can about this software, so I'm just trying to understand this UI feature.

If the green values represent a recursive expression calculating, do you have any idea why I wouldn't see these green values for other looping expressions that I've written? This is the only time I've ever seen this, but I've been writing expressions for years and use for loops whenever appropriate and have never seen them before.

Likes

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
Aug 10, 2021 Aug 10, 2021

Copied

A loop is not recursive. When you write "for every this do that until you find a solution" you have a recursive loop. Most calculate just fine. If I am not mistaken yours looks through every vertical pixel where X = 959 until it finds a specific color value. That is a thousand calculations per frame.

Sometimes you can't do anything else, but that kind of calculation is my last-ditch solution. I only go there if nothing else works.

Likes

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
Community Beginner ,
Aug 10, 2021 Aug 10, 2021

Copied

I understand how the code works; I wrote it myself. I just want to know when the values of an expression turn green. Is it if the expression takes over a certain amount of time to calculate? You said earlier that it's because I have a recursive loop, but I've had recursive loops before that didn't give me green expression values.

Likes

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
Guide ,
Aug 10, 2021 Aug 10, 2021

Copied

I'm guessing the value won't turn red until the expession has finished calculating for the current frame. sampleImage() is notoriously slow when used this way. You might be able to speed it up a little by using a sample radius of [.5,.5], which should evaluate a single pixel.

Likes

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
Community Beginner ,
Aug 10, 2021 Aug 10, 2021

Copied

I was originally guessing that expressions that take more than a certain amount of time to calculate might do a certain amount of calculations per processor cycle and would turn green to let you know that they're conserving resources behind the scenes.

I'm just surprised that I can't find any references to green values online, in the manual or otherwise. However, if Dan Ebberts answers your question regarding expressions and just has a best guess, it's safe to assume that nobody outside of Adobe truly knows. Thanks for the response.

Likes

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
Guide ,
Aug 10, 2021 Aug 10, 2021

Copied

This is actually kind of interesting. You don't see the incrementing green numbers in CS6 or CC (maybe because the expression is quite fast in those versions). But with CC 2017, something changed that causes that calculation to become incredibly slow. I don't know if it's a bug or a side effect of some other change.

Likes

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
Community Beginner ,
Aug 10, 2021 Aug 10, 2021

Copied

I'm using the most up to date version of AE, currently, and that's where I'm experiencing it.

From what I've seen online, sampleImage() seems to behave contrary to what might be expected. For example, this Creative Cow post says that a sampleImage() running for every pixel in a 1080 column is slow and sometimes times out, but changing the loop to evaluate on every other pixel makes it preview faster than real time.

It makes me wonder if sampleImage() has some sort of inefficiency when it comes to caching or garbage collection.

Likes

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
Guide ,
Aug 10, 2021 Aug 10, 2021

Copied

LATEST

I'd suggest that you use Help > Provide Feedback to report this issue so that someone at Adobe will take a look at it.

Likes

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
Resources
Troubleshooting FAQs
After Effects Community Recap
Getting started with After Effects