you could use sampleImage() in each layer’s opacity (or scale) property to sample your luma matte.
to make the expression easier, i would probably convert your luma matt to an alpha with an effect like channel combiner (set from>luminance and to>alpha only).
then the expression for opacity would look like this:
target=thisComp.layer(“luma matte”); // set this to your luma matte layer
target.sampleImage(position, radius = [.5, .5], postEffect = true, t = time)[3] * 100
or scale:
target=thisComp.layer(“luma matte”);
s=target.sampleImage(position, radius = [.5, .5], postEffect = true, t = time)[3] * 100;
[s,s]
depending on how you want things to work, you could set the sampleImage sample radius to use the layer’s width & height by changing radius to [width/2,height/2].
if you wanted the layer to be eight on or off (nothing in between), you could add a rounding function to the sampleImage value like this:
Math.round(target.sampleImage(position, radius = [.5, .5], postEffect = true, t = time)[3]) * 100
Kevin Camp
Senior Designer
KCPQ, KMYQ & KRCW