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

Call another function from within a JSX file

Participant ,
Feb 07, 2020 Feb 07, 2020

Is it possible to call another function, or refer to another variable, from within the JSX footage file?

 

For example, I'd like to achieve this:

 

 

{
  "opacity": 0.5,
  "blend":function(x){ 
     return x * WHAT.opacity;
  }
  "mix": function(x,y) {
     return WHAT.blend(x) + WHAT.blend(y);
  }
}

 

 Where `WHAT` is what I'm looking for to refer to the other contents of this JSX file.

 

TOPICS
Scripting
372
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 ,
Feb 08, 2020 Feb 08, 2020

A JSON file is just data. It doesn't evaluate by itself. Of course you could read the relevant parts and have them run via eval() in the expression, but writing those explicit references would likely take more code than just writing the functions natively in the expression editor, so it's kinda moot.

 

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
Participant ,
Feb 08, 2020 Feb 08, 2020
LATEST

I'm referring to the JSX import and call functionality as described here and here

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