Activity › Forums › Adobe After Effects Expressions › Debugging expressions: how to print value?
-
Debugging expressions: how to print value?
Posted by Paulo Jan on May 24, 2008 at 11:53 pmHi all:
How can I access the value that a given variable has at a certain point? I tried with:
thisComp.layer(“Monitor”).text.sourceText=variable;
Where “Monitor” is an empty text layer and “variable” the variable I want to monitor, but it doesn’t get updated.
Thanks in advance,
Paulo.
Dan Ebbertsreplied 17 years, 1 month ago 2 Members · 3 Replies -
3 Replies
-
Dan Ebberts
May 25, 2008 at 12:37 amIt depends on the expression. Sometimes you can just apply the same expression to a slider and comment out everything that happens after your variable gets assigned.
Sometimes you can apply your expression to the source text of a text layer, again commenting out everything after the variable is assigned. Using this method though, you might have to modify the expression a little because it’s being applied to a different layer.
If you need help, post your expression and we’ll take a look.
Dan
-
Paulo Jan
May 25, 2008 at 11:04 amOkay, here it goes.
I’m trying to do basically the typewriter effect that I mentioned in my post below: the letters in a text layer appear one by one, and when it reaches an end of line, the text scrolls one line upwards. “Animator 1” and “Range Selector 1” are the animators that I’m using to control the visibility of the letters: the “start” property of the range selector increases through the animation, so that more and more letters are visible in each frame, etc., etc.
Now, my problem is that the scrolling doesn’t always happen exactly when an end-of-line is reached; sometimes there’s a delay of 2 or 3 letters until the text scrolls, and the drift gets more pronounced as you advance through the animation. That’s why I’m trying to view the amount of line breaks that the expressions “sees” in a given moment (stored in “contador”), by printing it in a different text layer called “Monitor”… but it doesn’t work.
contador=0;
currentLetter = Math.ceil(text.animator(“Animator 1”).selector(“Range Selector 1”).start);
for (i=0 ; i < currentLetter; i++) { temp2 = text.sourceText.charAt(i); if (temp2 == '\\r') { contador++; } } thisComp.layer("Monitor").text.sourceText=contador; [position[0], position[1] - (48 * contador)]; (BTW, I know that in line 5 I should be comparing the letter with "backslash r"; this forum seems to strip single backslashes, and if I put double backslashes, it prints both of them). Paulo. -
Dan Ebberts
May 25, 2008 at 5:41 pmWell, the basic problem is that you can’t set the value of another property from an expression. An expression can only affect the property to which it is applied. So…. I would apply a slider to the layer with the expression, and apply this exprssion to the slider:
contador=0;
currentLetter = Math.ceil(text.animator(“Animator 1”).selector(“Range Selector 1”).start);
for (i=0 ; i < currentLetter; i++) { temp2 = text.sourceText.charAt(i); if (temp2 == '\r') { contador++; } } contador Dan
Reply to this Discussion! Login or Sign Up