I've built an arrow that is controlled by two nulls - one at the start point and one at the end point. Using some trigonometry in some expressions, it works. When I move the nulls, the arrow resizes appropriately.
But when I try to parent one of the nulls to another object (like another null, or a shape layer), the null position jumps. And even after parenting, the parent null can't move the child null.. Any ideas?
video:
Below are snippets of the controlling code, based on some scripts by others that I found online.
arrowlength controlled by
CellTower = thisComp.layer("startpoint").transform.position;
Target = thisComp.layer("endpoint").transform.position;
sizefactor = 100/(effect("ArrowSize")("Slider"));
BeamLength = (length(CellTower, Target)*sizefactor)-150;
[BeamLength]
rotation of the arrow controlled by
CellTower=thisComp.layer("startpoint").transform.position;
Target=thisComp.layer("endpoint").transform.position;
// Find the length of side a
SideA = sub(CellTower, Target)[1];
// Find the length of side b
SideB = sub(CellTower, Target)[0];
//Find the Angle between them
-1*(270-(radiansToDegrees(Math.atan2(SideA, SideB))+180));