Copy link to clipboard
Copied
Reason for asking, I have these calculations that have very long links to other attributes in the composition, mostly slider controls like for eg:
time < thisComp.layer("[CONTROLS]").effect("Total Animation Period")("Slider") - thisComp.layer("[CONTROLS]").effect("bkgd fade period")("Slider")? clamp(transform.opacity * time / thisComp.layer("[CONTROLS]").effect("bkgd fade period")("Slider"), 0, value) : clamp(transform.opacity * (thisComp.layer("[CONTROLS]").effect("Total Animation Period")("Slider") - time) / thisComp.layer("[CONTROLS]").effect("bkgd fade period")("Slider"), 0, value)
This could be reduced to something much easier to read, and more importantly save me a tonne of quickpicking/typing if I could set global variables to the relevant composition settings and values at various indexes (preprogrammed states that can be selected between by user or expression logic) (at least global in the scope of the AE comp containing the expression).
it would look like this:
time < totalTime - bkgdFadePeriod ? clamp(this * time / bkgdFadePeriod, value) : clamp(totalTime - time/bkgdFadePeriod)
Can think of lots of advantages to this kind of referencing, any downsides? I'll suck it and see and report back.
There is no such thing as "scope". An expression only evaluates inside its property stream and that's it. It's totally ignorant of the outside world unless you reference external property streams and those again only return values, not actual variables, functions or whatever in the programming sense.
Mylenium
Copy link to clipboard
Copied
There is no such thing as "scope". An expression only evaluates inside its property stream and that's it. It's totally ignorant of the outside world unless you reference external property streams and those again only return values, not actual variables, functions or whatever in the programming sense.
Mylenium
Copy link to clipboard
Copied
Thanks, so I wasn't going mad. Copy and pasting my script intros with variable assignments is best I can think of for now… I saw a tutorial where a guy had a script that changed the colour of a circle object by an expression on the Hue value of a HSL Colorise effect and the expression script tested the distance to five other circles and adjusted hue according to distance to nearest object.
He wanted the script to run on the other five circles but rather than cutting and pasting the expression script, he did something else, which I forget now.
Get ready! An upgraded Adobe Community experience is coming in January.
Learn more