Expressions/Scripts/Presets

Moderators: Disciple, zlovatt

Thunderino
Topic Author
Posts: 3
Joined: Mon Dec 22, 2008 8:30 am

### Find lines intersection

graphic.jpg (15.59 KiB) Viewed 7104 times

Hi all! This is the problem. I'm animating a technical graphic with 2 axes.
The X axis is time and the Y axes is another parameter. The white line moves straight forward from 1 to 11 and the white circle moves exactly on the red line because the red line is a path i did in Photoshop and put in the circle position property. I want the white circle to be always positioned in the intersection between the white and the red line. I tryed to link the x axes of the circle to the x axes of the line and leave its Y values but in this way the circle goes off the red line...
Thenks for the help!

zold

### Re: Find lines intersection

Fun problem. At first crack, I would say that you need to have the line follow the circle instead of vice-versa, by expression-linking the line's (x) position to the circle. so the line's position would have an expression something like:
``[thisComp.layer("circle").position[0], value[1]]``

But I realize this may be a problem if you want the line to be moving at a constant speed from left to right, in which case this requires more thought on my or someone's part ...

Thunderino
Topic Author
Posts: 3
Joined: Mon Dec 22, 2008 8:30 am

### Re: Find lines intersection

You're right, this is the problem. The lines moves at a constant speed so you should tell to the circle to move faster or slower. It's difficult to understand how I can tell to the circle to go faster without crossing the line. Very nice question it seems!!

Mylenium
Posts: 139
Joined: Wed Jul 20, 2005 12:07 am

### Re: Find lines intersection

Should be simple. Just some quick thoughts:

- determine the ratio of the line traveling speed compared to the duration of the graph curve draw on
- feed the resulting multiplier into a valueAtTime() expression referencing the line for X and the respective Y value from the curve

Mylenium
[Pour MylÃ¨ne, ange sur terre]

kobyg
Posts: 128
Joined: Fri Dec 07, 2007 10:11 am

### Re: Find lines intersection

Thunderino,
If this is still relevat, please post a project file so we can understand better how you've built the elements,
and understand the problem better, and hopefully could find a solution.
If I understood the problem correctly, this is not as simple as it seems, but I have an idea how to solve it.
I just have to see your project file to see if I understood the problem correctly.

Koby.

### Who is online

Users browsing this forum: No registered users and 1 guest