## How to calculate with expressions ???

Moderators: Disciple, zlovatt

BlackPyro1994
Posts: 2
Joined: August 1st, 2010, 11:33 am
A few days ago , I wanted to know how to connect a Laser Effect and and an Light Effect so that their coordinates are the same . Now can anyone tell me how to write an expression that can calculate the position of maybe"Laser" Time 45% , so that the position of the Light moves to the 45% Coordinate and not the real EndPoint .
Disciple
Posts: 137
Joined: June 5th, 2004, 8:05 am
Location: Los Angeles, CA
Contact:
Are you talking about doing this in a procedural way so that the light is always at a 45% distance from the end point? You'd probably have to calculate the length of the beam for that, which you could probably do by doing some comp math with the beginning and end point of the laser.
The non procedural way would obviously be to just create an offset in your position

Alex
Paul Tuersley
Posts: 704
Joined: June 5th, 2004, 7:59 am
Location: London, UK
This is pretty easy to do, although the exact expression required may depend on you giving a more accurate description of what your "Laser Effect" and "Light Effect" is. Assuming your "Laser Effect" is "Beam" and it's on a comp sized 2D layer, something like this should set the position of another layer, or the 2D position of another effect that's on a 2D comp sized layer to the 45% mark.

Code: Select all

``````start = thisComp.layer("Solid 1").effect("Beam")("Starting Point");
end = thisComp.layer("Solid 1").effect("Beam")("Ending Point");
linear(.45,start,end);
``````