Skip to main content
Known Participant
September 27, 2022
Answered

Expression Error - Recursive function

  • September 27, 2022
  • 1 reply
  • 271 views

Hi, 

 

So I have a little bit of a complicated comp with a lot of expressions animating it. The expressions are basically the same just with some values changed. Its quite a large comp but I have started working in a proxy the quater of the size but it hasn't helped. There aren't technically any expression errors but because of how many functions I have calling on one another AE keeps crashing and it pops up with an expression error occasionally and then disapears - "maximum call stack size exceeded, an expression was disabled as a result of the error".

 

The expression is below:

 

var markerIn = thisLayer.marker.key(1).time;
var x = thisComp.layer(index-1).position[0] - 1097;
var dur = 60;

linear(time, markerIn-dur, markerIn, x, x +177);

 

I basically have a master null animating the x position of 33 columns of content to the right over the course of 5 minutes. These columns as they move across then independantly need to move their x positions so the spacing between them changes when they reach certain points. I need each of the columns to read the position of the column before it and keep a consistent distance as well as change the distance when it reaches its certain point. My expression was working until I put it on all the columns I had in the comp (the first column, index 1, is the only one where the x position is "var x =  position[0];"). I'm not sure how to write in a base case to stop the expression calling on itself, or if thats even the correct fix? I have a very basic understanding of expressions so any help would be great. 

This topic has been closed for replies.
Correct answer Mylenium

This actually appears to be an error in the expression engine iztself where certain calculations make it go *kaboom*. It seems that in particular such expressions referencing other items produce nonsensical values at some point and then everything goes down the drain. Could well be that all your subtractions may cause a value overflow. Similarly, a spike in your graph editor curves on the first layer could multiply across all succeeding layers and produce insane values. Hard to say, though. I would simply drill open the value redouts and check. Otherwise you can try to pre-compose individual groups of your layers. As long as the relative spacing and motion to the left edge of the comp remain intact, I can't see why this shouldn't be an option.

 

Mylenium

1 reply

Mylenium
MyleniumCorrect answer
Legend
September 27, 2022

This actually appears to be an error in the expression engine iztself where certain calculations make it go *kaboom*. It seems that in particular such expressions referencing other items produce nonsensical values at some point and then everything goes down the drain. Could well be that all your subtractions may cause a value overflow. Similarly, a spike in your graph editor curves on the first layer could multiply across all succeeding layers and produce insane values. Hard to say, though. I would simply drill open the value redouts and check. Otherwise you can try to pre-compose individual groups of your layers. As long as the relative spacing and motion to the left edge of the comp remain intact, I can't see why this shouldn't be an option.

 

Mylenium

Kym5E5EAuthor
Known Participant
September 27, 2022

Thank you for your answer! Its helped me pin down the issue. As some of the columns move off the end of the comp it seems the expressions then have an issue reading their positions which as you say must be returning nonsensical values. I have increaded the width of the comp so the columns have more space to move and I'm not getting anymore errors.