Exit
  • Global community
    • Language:
      • Deutsch
      • English
      • Español
      • Français
      • Português
  • 日本語コミュニティ
  • 한국 커뮤니티
0

Expression for source text

Contributor ,
Jan 08, 2018 Jan 08, 2018

I have this line in an expression on one layer (say "LayerA"):

randNum=Math.round(random(0,4))+effect("Color Offset")("Slider");

Is there a way i can use 'randNum' from LayerA as the SourceText for a separate text layer (layerB)?

2.8K
Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines

correct answers 1 Correct answer

LEGEND , Jan 09, 2018 Jan 09, 2018

You have a completely wrong understanding how expressions in AE work. There is no such think as global variables and the return value is always the absolute value of the property stream, nothing more, regardless whether it's generated by keyframes, expressions or a combination of one on top of the other. If the code is part of a larger construct, then you need to post the code in its entirety. Otherwise nothing stops you from generating the random values on a separate expression control if it ne

...
Translate
LEGEND ,
Jan 09, 2018 Jan 09, 2018

Simply pickwhip the expression to the source text.

Mylenium

Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Contributor ,
Jan 09, 2018 Jan 09, 2018

Hey Mylenium -

I tried pickwhipping to the line defining randNumber, but that doesn't work.

And my problem is randNumber is not the final output of LayerA - it's simply used in a larger chunk of code.

I was hoping to link to some variables and show them on screen as text so I could try to debug the code and figure out where things are going wrong.  Wasn't sure if I needed to use Return to make the variable available to other layers, or make it a Global as opposed to Local variable, or do anything with numbers to text.  If any of those would work, i was hoping someone could show me the syntax to use in After Effects.  From what I've read online, I'm not sure that After Effects lets you directly access another layer's variable - so was just trying to get some clarification.

Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
LEGEND ,
Jan 09, 2018 Jan 09, 2018

You have a completely wrong understanding how expressions in AE work. There is no such think as global variables and the return value is always the absolute value of the property stream, nothing more, regardless whether it's generated by keyframes, expressions or a combination of one on top of the other. If the code is part of a larger construct, then you need to post the code in its entirety. Otherwise nothing stops you from generating the random values on a separate expression control if it needs to be re-used by multiple other expressions. Again, you simply have things backwards.

Mylenium

Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Contributor ,
Jan 09, 2018 Jan 09, 2018
LATEST

You're certainly right that my knowledge of expressions in AE is rudimentary.  I've learned just enough javascript / actionscript / and PHP in the past to be dangerous - remembering bits and pieces of how things work and able to slog through other people's code to get the gist of how things work. Going to read through some of the After Effect manual on expressions go through some more tutorials and sites to get a better background.  (didn't want to post the whole code block, because it came from a tutorial and I didn't want to post someone else's material)

Thanks for your help (and info on global variables and how 'return value' works in AFX expressions)

Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines