AE ENHANCERS

Expressions/Scripts/Presets
It is currently Fri May 24, 2013 5:36 pm

All times are UTC - 8 hours [ DST ]




Post new topic Reply to topic  [ 7 posts ] 
Author Message
 Post subject: Concatenate texts
PostPosted: Tue Oct 04, 2011 11:49 am 
Offline

Joined: Sun May 01, 2005 1:52 pm
Posts: 129
All I want to do is concatenate a few expression results.
Here's what I'm trying to do:
Code:
R = thisComp.layer("CDL Lables").effect("CDL")("Red Slope");
G = thisComp.layer("CDL Lables").effect("CDL")("Green Slope");
B = thisComp.layer("CDL Lables").effect("CDL")("Blue Slope");
string=R, G, B


This only results in the R value being displayed. I've tried the + operator but that adds the values together rather than concatenating them.

The result I'm looking for would look like this: 1.234, 3.456, 7.890

Thanks


Top
 Profile  
 
 Post subject: Re: Concatenate texts
PostPosted: Tue Oct 04, 2011 3:12 pm 
Offline

Joined: Sun May 01, 2005 1:52 pm
Posts: 129
BTW, this is in the source text field of a text layer.


Top
 Profile  
 
 Post subject: Re: Concatenate texts
PostPosted: Tue Oct 04, 2011 3:28 pm 
Offline

Joined: Sat Jun 05, 2004 7:59 am
Posts: 646
Location: London, UK
You could do:
Code:
string=R.value + "," + G.value + "," +B.value;


Top
 Profile  
 
 Post subject: Re: Concatenate texts
PostPosted: Tue Oct 04, 2011 7:19 pm 
Offline

Joined: Sun May 01, 2005 1:52 pm
Posts: 129
YES!
That's what I've been looking for but I couldn't get the code right.
I added a space after each comma and it works great.

I don't suppose there's any way to tell it to colorize each number separately, is there?
Ideally, I'd like the first number to be ... red, green, blue.

Thank you PT!


Top
 Profile  
 
 Post subject: Re: Concatenate texts
PostPosted: Tue Oct 04, 2011 7:21 pm 
Offline

Joined: Sun May 01, 2005 1:52 pm
Posts: 129
One more thing. Is there a way to limit the number of decimal places?


Top
 Profile  
 
 Post subject: Re: Concatenate texts
PostPosted: Wed Oct 05, 2011 12:55 am 
Offline

Joined: Sat Jun 05, 2004 7:59 am
Posts: 646
Location: London, UK
This will limit it to 2 decimal places:
Code:
string=R.value.toFixed(2) + ", " + G.value.toFixed(2) + ", " +B.value.toFixed(2);

You won't be able to set individual text colors if you do this on a single text layer. When an expression is applied it appears to take the style from the first character of the layer's pre-expression state.

You could either:
a. If the text is against a transparent background (e.g. created in a precomp before composited) you could create some red, green and blue solid layers, set their Blending Mode's to Color, turn on Preserve Transparency and place them over the specific bits of text.
b. Set the initial color to red through the character panel, then add a text animator ("Animate" menu just above source text property) for Fill Color > RGB, set it to Green and change the start and end of the range selector to fit the specific characters. Duplicate that animator (Animator 1) and change it to do the same for blue.


Top
 Profile  
 
 Post subject: Re: Concatenate texts
PostPosted: Wed Oct 05, 2011 12:40 pm 
Offline

Joined: Sun May 01, 2005 1:52 pm
Posts: 129
Oh hell yeah! That rocks!

Thanks again. You're amazing!


Top
 Profile  
 
Display posts from previous:  Sort by  
Post new topic Reply to topic  [ 7 posts ] 

All times are UTC - 8 hours [ DST ]


Who is online

Users browsing this forum: Google [Bot] and 1 guest


You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot post attachments in this forum

Search for:
Jump to:  
Powered by phpBB © 2000, 2002, 2005, 2007 phpBB Group