Ah, old memories…
I created a Yellow Line in Illustrator that was 900 x 10 pixels. I actually made it a dashed line for creative reasons.
Then my idea was to anchor the left edge of the line to the first point, and then determine the x scale and angle of rotation to make it to the second point. Here’s how…
Set the anchor point to 0,5 (Left edge, half of height)
Use an expression to set the position to match the first point. For example, thisComp.layer(“CellTower 01”).transform.position
Use another expression to determine the scale:
CellTower = thisComp.layer(“CellTower 01”).transform.position;
Target = thisComp.layer(“Dan Green”).transform.position;
BeamLength = length(CellTower, Target)*(100/width);
[BeamLength-.5,10]
Celltower and Target are the two points.
BeamLength is the distance between the two points multiplied times 100/the width of the line.
Then subtract .5 to shrink it a little.
That takes care of the X scale (line length), but what about the line width or thickness? I actually used the following expression for the scale…
First I created an expression slider effect named Camera Scale and gave it this equation:
//Value should range from zero to one
CellTower = thisComp.layer(“CellTower 01”).transform.position;
Target = thisComp.layer(“Dan Green”).transform.position;
Delta = sub(CellTower, Target);
Math.abs(length(Delta))*.0006
By tweeking the value .0006 I was able to get this value to vary from zero to one (approximately) based on the shortest and longest distance.
Then I used this expression for the Scale:
CellTower = thisComp.layer(“CellTower 01”).transform.position;
Target = thisComp.layer(“Dan Green”).transform.position;
BeamLength = length(CellTower, Target)*(100/width);
CameraScale = Math.abs(-thisComp.layer(“Camera Scale”).effect(“Camera Scale”)(“Slider”));
[BeamLength-.5,(CameraScale*22+4)]
The Camera Scale allowed me to adjust the width of the line based on the “zoom” factor. Since this was determined by tracking existing footage, I needed to link it to existing tracking data using this expression:
.8-thisComp.layer(“Helicopter Track Axis”).transform.scale[0]/1200
Of course, you will need to come up with something on your own for this.
See how easy this stuff is?
One last thing… the Rotation. Here is the expression for Rotation:
CellTower=thisComp.layer(“CellTower 01”).transform.position
Target=thisComp.layer(“Dan Green”).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
radiansToDegrees(Math.atan2(SideA, SideB))+180;
For the fun of it, I had the transparency and Hue of the line change based on the “signal strength”. I’ll let you figure that one out.
Looking back at all this I realise that it can be greatly simplified, but I had a job to do and didn’t have time for housecleaning. If it works, don’t fix it.
To see my finished comps, go to my web page and watch the “Hidden Camera Footchase Sequence” on my Portfolio page.
http://www.sparkmedia.com