-
technique: using a text-layer to store an object
Hey Guys,
I just tried something wacky in another thread, and it works.
Using an expression on a text-layer to create a string-representation of an object.
Then eval() that string in other expressions.I did it to have some global calculations done it that text-expression, and to pass along more than 1 variable at a time.
Thought some more about it, and you can even include global functions or prototypes that way. Has this been done before and have I missed it ?
quick check:
paste this in a text-layer “txt”.function quadruple(i) {return i*4}
function triple(i) {return i*3}
obj={a:1, quadruple:quadruple,triple: triple ,c:5}use this in an expression:
eval(thisComp.layer(“txt”).text.sourceText.value);
quadruple(3);returns 12 !
your thoughts ?