Page 1 of 1

How to calculate with expressions ???

Posted: August 7th, 2010, 5:36 am
by BlackPyro1994
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 .

Re: How to calculate with expressions ???

Posted: August 24th, 2010, 5:09 pm
by Disciple
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

Maybe show your expression?

Alex

Re: How to calculate with expressions ???

Posted: August 25th, 2010, 2:15 am
by Paul Tuersley
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);