Trim Path & Make Layer Above Visible Only When Path is Visible
So to start with, I've got this from way back when:
L = thisComp.layer("Layer 2/Mouse Cursor.ai");
p = L.transform.position;
sampleImage(p,[.5,.5],true)[3] > 0 ? 100 : 0
It's from an old project, which emulated the Windows GUI and governed the mouse-hover effects (when the mouse cursor was over something it would become visible just like in Windows).
I'm looking to do something similar now but I can't figure out how to do it. Basically, I've got a path that draws a line through a scene courtesy a Trim Paths property, with dots marking vertices in the path (so anytime the path turns, there's a dot to mark it). What I'm looking to do is for the dots to sample the path layer, and when the path becomes visible beneath them, for the dots themselves to become visible.
I know SampleImage is the key to making it work, but I can't figure out how to go about it.
I feel like this is close (applied to the Opacity property of one of the "dot" layers):
target = thisComp.layer("Shape Layer 1");
target.sampleImage([transform.xPosition,transform.yPosition], [5,5], true) > 100 ? 0 : 0
As best I understand it, it's telling AE to sample Shape Layer 1, and when it becomes visible at the coordinates of the dot itself, plus or minus 5 pixels, then it becomes visible...but it's not working.
Can anybody help me straighten this out?
EDIT: it's a 3D scene using the Classic 3D renderer if that makes a difference
