ADOBE AFTER EFFECTS: Forum Expressions Tutorials Creative Cloud

break in source text

COW Forums : Adobe After Effects Expressions

<< PREVIOUS   •   FAQ   •   VIEW ALL   •   PRINT   •   NEXT >>
Micheel Leavitt
break in source text
on Sep 5, 2009 at 6:20:10 pm

What is required to make a "list of values that would display like:

2.254
5.246
6.257
1.258
3.256
etc

I have a line of Nulls that are taking sample data from an audio spectrum, and I wanted to have them display the data right next to the Null. The spectrum sprouts out and moves left to right, not down to up, so that is the need for a list. There is about 20 nulls and they are all the same length, so what I wanted was to find the right text size and then just add toFixed() to their value and have them list out. I suppose I should just ask how do you press "enter" to start a new line in the expression? Thanks for any help!


Return to posts index

Dan Ebberts
Re: break in source text
on Sep 5, 2009 at 6:45:41 pm

Just add backslash r between items:

"2.254" + "\r" + "5.246"

or

"2.254\r5.246"

Dan



Return to posts index

Micheel Leavitt
Re: break in source text
on Sep 5, 2009 at 6:50:55 pm

Sweet, thanks a lot Dan, that helps a lot. Its a shame that you can't read the data from multiple properties while doing a Ram preview. (Or is there?) Either way this makes it easier, even if it's going to slow down preview speed. :} Thanks again


Return to posts index


Micheel Leavitt
Re: break in source text
on Sep 5, 2009 at 7:00:26 pm

Gah, for some reason it is having an error on the last line, it wants a ";" somewhere, I added one to the end but that didn't work. Heres the code so far (about half of the values)

z = toFixed(2);
a = thisComp.layer("a").effect("Final Range Value")("Slider").z;
b = thisComp.layer("b").effect("Final Range Value")("Slider").z;
c = thisComp.layer("c").effect("Final Range Value")("Slider").z;
d = thisComp.layer("d").effect("Final Range Value")("Slider").z;
e = thisComp.layer("e").effect("Final Range Value")("Slider").z;
f = thisComp.layer("f").effect("Final Range Value")("Slider").z;
g = thisComp.layer("g").effect("Final Range Value")("Slider").z;
h = thisComp.layer("h").effect("Final Range Value")("Slider").z;
i = thisComp.layer("i").effect("Final Range Value")("Slider").z;
J = thisComp.layer("a").effect("Final Range Value")("Slider").z;
"a" /r "b" /r "c" /r "d" /r "e" /r "f" /r "g" /r "h" /r "i"

So what am I doing wrong? Thanks for any help!


Return to posts index

Dan Ebberts
Re: break in source text
on Sep 5, 2009 at 7:06:25 pm

Try it this way:

a + "/r" + b + "/r" + c + "/r" + d + "/r" + e + "/r" + f + "/r" + g + "/r" + h + "/r" + i

Dan




Return to posts index

Micheel Leavitt
Re: break in source text
on Sep 5, 2009 at 7:13:42 pm

That also gave a toFixed undefined error. Is it because I have toFixed(2) stored as a variable?


Return to posts index


Dan Ebberts
Re: break in source text
on Sep 5, 2009 at 7:18:45 pm

Sorry, I didn't notice you were using forward slashes. You use quotes for strings, but not for variables representing strings. So I would think you would want to do it this way:

a = thisComp.layer("a").effect("Final Range Value")("Slider").toFixed(2);
b = thisComp.layer("b").effect("Final Range Value")("Slider").toFixed(2);
.
.
.
a + "\r" + b + "\r" + .........


Dan



Return to posts index

Micheel Leavitt
Re: break in source text
on Sep 5, 2009 at 7:24:30 pm

Alright, the problem was the lack of "value" before the toFixed, and it now works, it just doesn't make a line break Dx and it also shows the /r in the source text, but hey, at least no code errors!


Return to posts index

Dan Ebberts
Re: break in source text
on Sep 5, 2009 at 7:27:40 pm

Still using forward slashes?

Dan



Return to posts index


Gyula Bodonyi
Re: break in source text
on Jan 3, 2019 at 9:40:43 am

Dear Dan!

I have a question about line breaks via script. I want to write a script that makes a text layer with an expression. It's all good, and working but if I want to make line breaks in the final result, the break only appears in my expression. Do you have any idea?

myComp.layer("").text.sourceText.expression =
"try{"+"\r"+
"L=parent;"+"\r"+
"t=time-L.inPoint;"+"\r"+
"tF=timeToFrames(t);"+"\r"+
"t=timeToCurrentFormat(t);"+"\r"+
"t+ ' \r ' +tF;"+"\r"+ // that would be the problematic part. It breaks the expression, not the final result.
"}catch(e){"+"\r"+
"'select a parent layer'"+"\r"+
"}"


Return to posts index

Micheel Leavitt
Re: break in source text
on Sep 5, 2009 at 7:12:13 pm

Okay, so I changed the slashes to backslashes, but then it gave a syntax error, then I made it look more like this:

"a \r b \r c \r d"

but then function toFixed is undefined. So it wasn't just the forward slashes that had me.


Return to posts index

Micheel Leavitt
Re: break in source text
on Sep 5, 2009 at 7:28:17 pm

Alright alright, I was still using the forward slash piece from earlier, but I changed all the slashes and it works perfectly! Thanks a lot Dan, this really will help make what I'm doing much easier. I got an audio spectrum that has a line of nulls reading the spectrum layer, and it displays a percentage for how much of the spectrum layer fills the null. Seeing all of the nulls values in realtime makes it easy to see what ranges are the most reactive. Thanks so much again!


Return to posts index

<< PREVIOUS   •   VIEW ALL   •   PRINT   •   NEXT >>
© 2019 CreativeCOW.net All Rights Reserved
[TOP]