Hi Malcolm, try this for the layer’s anchorPoint:
posterizeTime(0);
l = thisLayer;
w = l.width;
h = l.height;
threshold = 0.1;
s = [0, 0, 0, 0];
for (x = 0;
(s[3] < threshold && x <= w); x++) s = l.sampleImage([x, h / 2], radius = [0.5, h / 2], postEffect = false, t = time);
leftEdge = x;
s = [0, 0, 0, 0];
for (x = w;
(s[3] < threshold && x >= 0); x--) s = l.sampleImage([x, h / 2], radius = [0.5, h / 2], postEffect = false, t = time);
rightEdge = x;
s = [0, 0, 0, 0];
for (y = 0;
(s[3] < threshold && y <= h); y++) s = l.sampleImage([w / 2, y], radius = [w / 2, 0.5], postEffect = false, t = time);
topEdge = y;
s = [0, 0, 0, 0];
for (y = h;
(s[3] < threshold && y >= 0); y--) s = l.sampleImage([w / 2, y], radius = [w / 2, 0.5], postEffect = false, t = time);
bottomEdge = y;
pixelRect = {
top: topEdge,
left: leftEdge,
width: (rightEdge - leftEdge),
height: (bottomEdge - topEdge),
right: rightEdge,
bottom: bottomEdge,
center: [leftEdge + (rightEdge - leftEdge) / 2, topEdge + (bottomEdge - topEdge) / 2]
};
pixelRect.center;