-
Trying to get a function from a text source via expressions : line break break the atempt …
Hi !
It seems there is no natural way to use global functions in AE. (it really complicates my daily life these days …)
I tried to define two such functions in a text layer and access them in an expression :monCode = thisComp.layer(“CODE —–JS —–“).text.sourceText.value
eval(monCode);It doesn’t work because of the line breaks in the code of my global function. In fact when I strip the string of its line feeds (with a text editor) it works. :
(but living in a line-break-less world is a nightmare.)
I tried this :monCode = thisComp.layer(“CODE —–JS —–“).text.sourceText.value
monCode = monCode.replace(/(\r\n|\n|\r)/gm, ” “);
eval(monCode);It does no good.
In fact the js code of my global function seems to be ignored in the text source property if there is a line break in it.Anybody knowing a solution ?
And BTW, do you know why these necessary-obvious-basic global functions are not present in AE.
Is there a plugin doing this ?T-H-A-N-K-S !
monCode = thisComp.layer("CODE -----JS -----").text.sourceText.value
eval(monCode);then :
monCode = thisComp.layer("CODE -----JS -----").text.sourceText.value
monCode = monCode.replace(/(\r\n|\n|\r)/gm, " ");
eval(monCode);