I need to animate two lines. They should be separate but moving freely. At some point, they should touch each other like in the picture below.
Do you know how to animate their intersection / the place where they will touch each other (and the radius between them)?
It probably could be rigged with all sorts of complex expressions, but ultimately it could juss as well be a case of animating backwards. Build the final position with shape layer paths and additional rectangles and circles for the fill, use Merge Path operators to create the cutout roundings and then animate fromn the end to the start. Duplicate/ split the layer and remove unnecessary stuff in the segemnts where the paths move freely.
Good idea, even though there won't be a final position as the lines should keep being in motion so the joint between them should always change (be smaller, larger). When paths are merged in this case, is it possible to animate the radius between them then?
Perhaps I'm misunderstanding the question,but why wouldn't you simply isolate the two lines onto different layers and then animate them? Or are you asking how to create the globular join between them as they touch?
Yes, I was referring to the joint as they touch. The lines should keep being in motion and the joint should change all the time.
Cleanly keeping them connected would require complex math to keep the rounding tangentially aligned. If it needs to be random a better workflow might simply be to make the lines a lot thicker, blur them heavily with a Box Blur or Gaussian Blue (at least 3 iterations) and then clip back the soft areas with a curves or levels effect to produce harsh edges again. You need to experiment with the settings, apparently, and there may be situation where this doesn't look clean enough.
If you add Gaussian Blur to a shape, then add Refine Hard Matte, you can sharpen up the edges of the blurred intersection and simulate something like wet ink lines blending into each other. This is what I got in just a couple of minutes.
A couple of other workflows can blend shapes like liquids do when they get close, but this one should do what you want. Set the color of one line (shape) to a different color, and you'll also get color blending at the intersection.
I've attached the comp. Using the Create Nulls From Paths/Points Follow Nulls to animate the moving path.