Skip navigation

I needed a line to stretch between two objects that were in motion:

Create a solid and add the ‘Generate: Beam’ effect.

Enable expressions on the “starting point” and “ending point” of the effect. Pic-whip the “starting point” of the effect to the first object’s position, and “ending point” to the second object’s position.

If the line should simply connect the objects at their center-points, you’re done! But I wanted the line to fall short of the center-point, so I used the below expression in the ‘length’ attribute to create a gap between the line and each object:

//---------------------
//get total dist between icons using built-in 'length' function:
 // total length = length(start point - end point)
 lenTot = length(
 effect("Beam")("Starting Point")
 -
 effect("Beam")("Ending Point")
 );
// arbitrary amount that I'd like it to fall short 
// of the end points (90 pixels on each end)
 lenToSubtract = 180;
// convert this pixel amount to a percentage of the total length 
// because this ending value needs to be in percentages ultimately
 percentToReduce = (lenToSubtract*100)/lenTot;
// 100 would make the line simply connect. 100-percentToReduce reduces
// the length on each end by specified amount
 100 - percentToReduce;
//-----------------------
Advertisements

2 Trackbacks/Pingbacks

  1. […] a link to more usage of the Beam effect between dynamic objects in only […]

  2. […] a link to more usage of the Beam effect between dynamic objects in only […]

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s

%d bloggers like this: