-
Link Color To The Position Of Null
Hi everyone!
Hope you can help me to overcome my AE expression illiteracy ????
So basically I’m doing some UI demo animation and there’s a drop-out menu with font options. I want to make the area of the text option highlighted with light blue when the pointer touches the area of the font option. Pretty common stuff so to say.
There are 12 options total, so I have 12 rectangles underneath. When inactive, they’re whtite, when I position a null (the null I’ll attach the cursor to) over them, they’re becoming blue, that’s it.
I used an expression like this for the fill effect:
p1=thisComp.layer("cursor null").transform.position;
p2=transform.position;s=sub(p2,p1);
l=length(s);white=thisComp.layer("mask").effect("selectionWhite")("Color");
blue=thisComp.layer("mask").effect("selectionBlue")("Color");linear(l,25,24.5,blue,white);
It works, but not actually the way I want to. The sub() turns out to calculate the distance between two anchor points. But I have a 250×47 rectange. So if I move my cursor null from vertically straight over the anchor point of the rectangle, it’s ok. Yet if I touch left or right edge, it’s not working, because as you can see the the radius of color property activation has the diametre of 24.5 pixels around the anchor point of the rectangle.
How can I activate the color property at any point of the rectangle then?