3 Replies Latest reply on Nov 7, 2011 7:16 AM by Mylenium

# How to make an animated link between two shapes that move indipendently

Hello everyone,

I am looking many tutorials to find out how to create something like this:

http://turbulence.org/Works/mypocket/graph/

(the video are on the right)

But couldn't.

I for each shape, I would make 2 circles (moving separately) and between them make a shape that works as a link, parented on each circle on the sides.. is it clear? I need the link to "stretch" and follow the two circles..

Do you know if there is a way?

m.

• ###### 1. Re: How to make an animated link between two shapes that move indipendently

Use something like this technique from an old blog post I made years ago:

I created a layer called String and a layer called Kite. I drew an open mask on the String layer that shaped a gentle arc, added the Stroke effect with a width of 3 pixels and Paint on Transparent selected. The stroke goes from the left edge to the right edge of the String layer, and that's important. The String layer is slightly narrower than the comp to make it easy to work with. The last step with the String layer is to move the anchor point to the left most vertice point of the mask at exactly an X value of 0. this is also important. Both layers are converted to 3D.

The Kite layer is simply a square solid with a kite shaped mask and the anchor point moved to where the string would attach.

The following expressions are added to the string layer:
String Scale:

`point1 = position;point2 = thisComp.layer("Kite").position;L = length(point1, point2);w = thisLayer.width;r = L/w*100;[r, value[1], value [2]]`

String Orientation:

`t = thisComp.layer("Kite");l = thisComp.layer("String");fromPoint = l.positionatPoint = t.positionlookAt(fromPoint, atPoint)`

If you look carefully at the language you'll see that I'm calculating the distance between the anchor points and then dividing the distance by the layer width and multiplying that number by 100 to arrive at a scale factor so that the String layer is always the same length as the distance between the end of the string and the kite. The Orientation part of the expression simply points the string at the kite. There is one problem that must be overome. The string layer is perpendicular to the Kite so, and this part is important, the Y rotation must be changed to -90 to get things back to normal. This isn't another expression, it's just a value you put in.

The Kite layer also needs an expression to point the kite at the end of the string. The Kite orientation expression is basically the same as the String Orientation expression with definitions for the from and at point reversed. It looks like this:
Kite Orientation:

`t = thisComp.layer("String");l = thisComp.layer("String");fromPoint = t.toWorld(position);atPoint = l.toWorld(thisComp.layer("String").anchorPoint);lookAt(fromPoint, atPoint)`

Now the kite can be moved around and the string will follow.

Here's the project file

• ###### 2. Re: How to make an animated link between two shapes that move indipendently

I think I get it... thank you very much!

Best,

M.

• ###### 3. Re: How to make an animated link between two shapes that move indipendently

Millions of ways to do that. Aside from Rick's code, there's my old World Map tutorial on creativeCOW and you can definitely do it without any math at all by using the Beam effect on a comp sized solid and link the start and end point to the position of the layers using simple pickwhipping. Furthermore you can of course use plug-ins like Plexus to create such complex networks and of course I could tell you anotehr 10 methods with expressions, shape layers and certain effects. Realyl depends on what look you're after and how far you want to automate this...

Mylenium