I think this gets pretty close. If the center of the square gets inside a circle, it should pick up that circle’s color, otherwise black. To make it work if any part of the square touches the circle would take a bunch more code. You might also need to decide what to do if the center of the square is inside both circles. But it’s an encouraging start, I think.
C1 = thisComp.layer("RADIAL EFFECTOR 01");
C2 = thisComp.layer("RADIAL EFFECTOR 02");
r1 = C1.sourceRectAtTime(time,false);
radius1 = r1.width/2;
p1 = C1.toComp([r1.left+r1.width/2,r1.top+r1.height/2]);
r2 = C2.sourceRectAtTime(time,false);
radius2 = r2.width/2;
p2 = C2.toComp([r2.left+r2.width/2,r2.top+r2.height/2]);
myPos = thisProperty.propertyGroup(3)("Transform")("Position").value;
d1 = length(toComp(myPos),p1);
d2 = length(toComp(myPos),p2);
if (d1<radius1)
C1("Contents")("Ellipse 1")("Contents")("Fill 1")("Color")
else if (d2 < radius2)
C2("Contents")("Ellipse 1")("Contents")("Fill 1")("Color")
else
[0,0,0,1]