Activity › Forums › Adobe After Effects Expressions › Using Variables from another Layer
-
Using Variables from another Layer
Posted by Fred Lobo on September 17, 2007 at 6:43 pmHi folks, I
Francois Paradis replied 16 years, 7 months ago 4 Members · 8 Replies -
8 Replies
-
Dan Ebberts
September 17, 2007 at 7:18 pmYou can’t access the variables in another expression, just the result. You could put a bunch of text in one text layer though and have expressions in the other text layers search for their piece of the text (assuming you identify it somehow in the master text).
There’s prabably a way to accomplish what you’re trying to do.
Dan
-
Mike Clasby
September 18, 2007 at 4:25 pmHow about this…
Can you make each variable an Expression Control. I mean tie it to an Expression Control, like a Slider, name the slider what you want and then reference that slider in the other layer. You could then use that as a “variable”, or at least the result of the slider as a variable.
There are several expressing controls, a list follows and what they do, from the Help files.
Angle Control
This control contains a dial that rotates from 0 to 360 and adds rotations. You can adjust the angle control by dragging the dial or dragging the underlined values.
Checkbox Control
This control contains a single checkbox that you can click. You can animate this control to start and stop animation at specific intervals.
Color Control
This control contains a color swatch and an eyedropper. You can use this effect to control the gradual or sporadic change of colors on one layer or among several layers.
Layer Control
This control contains a layer menu that lists all of the layers in the active composition. You cannot add keyframes to this effect.
Point Control
This control contains an effect point control. You can use this to perform as a master control for animation in a series of layers.
Slider Control
This control contains a slider with a default value range of 0 to 100. To use values that exceed this limit, drag the underlined value above the slider instead. To change the slider range, right-click (Windows) or Control-click (Mac OS) the underlined slider value and choose Edit Value from the menu that appears. Type the new values in the Slider Range text box.
-
Fred Lobo
September 18, 2007 at 8:52 pmThat would work fine! If only I could link my Sliders to the Master Text Layer, so, every time I change any value in some piece of the Master Text Layer the respective Slider follow it. But I simply dont know how to do that (pickwhip does not work). I dont know how to make the slider follow the text… Any idea?
Thank you all,
Fred Lobo -
Dan Ebberts
September 18, 2007 at 9:17 pmAn more detailed example of what you’re trying to do would be helpful.
Dan
-
Fred Lobo
September 18, 2007 at 11:28 pmoh, sorry about that, i’ve should done that sooner. Anyway, what i’m trying to do is a Weather Forecast from some cities here in Brazil that I’ll change it daily. I have something right now that works like this:
-a MASTER COMP where all my cities and their weathers are listed in many individual Text Layers. This is just a working composition, it’s used only as a reference to my other layers.
-Many RENDER COMPs with the actual animation. I’ve linked the source text of my Text Layers in those compositions to the respective Text Layers of the MASTER COMP.
-The problem is the bunch text layers of my MASTER COMP. It’s painfull change it every day, because you have to double click every single Text Layer in the MASTER COMP to change it in the RENDER COMP
So, that’s what i
-
Dan Ebberts
September 19, 2007 at 1:29 amThe best way would probably be to put together a script that would read a text file and replace all the text in the text layers.
If you don’t want to do that, you could do it with expressions. As an example, say you have a master comp with a master text layer with a comma-delimited expression for source text that looks like this:
“text 1,text 2,text 3”
In another comp, you could have a text layer with an expression that extracts the the third string (“text 3”) of the master text – like this:
txt = comp(“master comp”).layer(“master text”).text.sourceText;
txt.split(“,”)[2]So the trick would be to put your text together in one string, separated by commas and then set up your other layers to extract the piece it needs using split().
Dan
-
Fred Lobo
September 19, 2007 at 8:23 pmThat was great! It works beautiful, the expression I mean, I didn’t found the right script (maybe someone who works with Excell, that would really be awesome). But the split() was really what I was looking for.
Thanks again for all the help.
Fred -
Francois Paradis
September 25, 2009 at 1:22 pmI found this great tutorial that gives the expression you were looking for. It loads text from a .text file.
Thank you
Harry J Frank and Maltaannon.https://www.graymachine.com/wp09/2009/03/expressions-and-external-documents/
Frank
#include'D:Temperature.txt'try{
eval (thisComp.name)
}
catch(err){"not found"}
Reply to this Discussion! Login or Sign Up