What is the scope of variables declared/assigned in expressions?
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.
