• Global community
    • Language:
      • Deutsch
      • English
      • Español
      • Français
      • Português
  • 日本語コミュニティ
    Dedicated community for Japanese speakers
  • 한국 커뮤니티
    Dedicated community for Korean speakers
Exit
0

Connect dots in a curved way

New Here ,
Oct 13, 2018 Oct 13, 2018

Copy link to clipboard

Copied

Hey,

I want to visualise a fictional node based software. For this i need to be able to make some kind of connection between two points.

I don't want the connection to be linear, but curved (like in the link) and i want it to update automatically when you move one or two points.

Connections - YouTube

Is this possible in After Effects?

Thanks in advance.

Views

3.0K

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
LEGEND ,
Oct 13, 2018 Oct 13, 2018

Copy link to clipboard

Copied

Sure it's possible, but if you really want to make it like in Houdini, then this will be complicated. Houdini doesn't use simple Bezier noodles like most node-graphs do. Otherwise feel free to have fun e.g. with the legacy Path text effect or by making good use of mask and shape layer paths connected to Null objects with expressions. You might also consider using a commercial plug-in called Plexus.

Mylenium

Votes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Advisor ,
Oct 13, 2018 Oct 13, 2018

Copy link to clipboard

Copied

Broadly speaking:

Create a 'stroke only' shape layer with four points using the pen tool - with RotoBezier mode on.

Window menu > Create Nulls from paths.jsx

Seelct the path in the shape layer - note: the path itself, not the path group.

Click the 'Points follow Nulls' button in the above dialog.

This will give you four nulls you can now animate. The path points will follow those nulls.

The Rotobezier mode will give you a more natural 'automatic' curvature to the path.

Votes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
New Here ,
Oct 13, 2018 Oct 13, 2018

Copy link to clipboard

Copied

Cool! Is this the "newest functionality of AE2018 of accessing vertex (and tangent) data" the first comment on this post is talking about? CreativeCOW

Like this feature.

Thanks!

Votes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Advisor ,
Oct 13, 2018 Oct 13, 2018

Copy link to clipboard

Copied

Yes - the feature I referenced above is based on expressions which were new functionality in 2018.

Using the rotoBezier method I suggested removes the need to control bezier tangents - the curvature is calculated automatically. So, less control, but less work.

If you want to use Bezier handles for more control - perhaps have a look at:

https://nomagnolia.tv/ae-link-path-points-tangents-nulls/

and

Hooker - aescripts + aeplugins - aescripts.com

Votes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
New Here ,
Oct 13, 2018 Oct 13, 2018

Copy link to clipboard

Copied

Allright. Yeah it's handy to control the tangets too..

The RotoBezier isn't right for the kind of curve i want i think... In this screenrecording you first see the movement i wanted.. But as you see, when i change the tangets, i change both + i also change the line thickness?

Screen Recording 2018 10 13 at 17 44 01 - YouTube

I want to create something like this:Screenshot 2018-10-13 at 18.04.44.png

Is there a way to, if i've created nulls for the tangets too, to make the 'tangets Nulls' have the same x axes as the 'vertices Nulls' and have the distance between the vertices and the tangets be the same on both sides, and on all the lines.. with one parameter/slider control? In this way i would have a 'smoothness/curve' control for the all the connections.

I don't know programming that well, unfortunately.

Thanks in advance!

Votes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Community Expert ,
Oct 13, 2018 Oct 13, 2018

Copy link to clipboard

Copied

I have not experimented with the tangents methods available in the Expression Language Menu > Path Properties menu but there may be something there. It's not something that I have time to play with right now but it sounds doable with a little research. I did see this After Effects tutorial: link path points AND tangents to nulls web page and there is a downloadable script that adds the ability to attach nulls to both the points and tangents of bezier paths. It may get you pointed in the right direction.

When I have done something similar I just start our drawing my path using a grid with snap to grid turned on. I'll make the path horizontal, about half as long as I expect it to be and stretch out the handles to the middle point. Let me be more clear. I'll turn on the grid and make sure that Snap to Grid is on, then for a path that I expect to be about 4 major divisions long at the shortest point in the animation I'll click on the intersection of one of the major divisions and drag to the right two divisions to set the length of the first bezier handle, then I'll lick on the fourth division and drag to the right again two divisions so the bezier handles are both the same length. Then I'll use the Points Follow Nulls from the new Create Nulls from Paths script. Now when I drag the nulls around I'll get a pleasing curve as long as the distance between the points isn't shorter than the starting distance between the nulls.

The script does include some tangent info and adds layer controls so it seems that you should be able to modify that information fairly easily by adding a slider. As I have said, I haven't had the hour or so it would probably take me to research the Path Properties methods and so some testing. I suggest that you post the question on the Expressions and Scripting Sub Space on this forum (link at the top of the forum) and see if Dan Ebberts will chime in. He is about the only contributor that I know that could probably write an expression that would work without even opening up AE.

Votes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Advisor ,
Oct 14, 2018 Oct 14, 2018

Copy link to clipboard

Copied

Here's video I've made for you:

https://goo.gl/ohn13V

Install the script from the first link I gave you above - that's what I'm using.

Select the path you want to work with. Note: the path itself, not the path group. I didn't need to do that as I'd just drawn the path. The script will create null layers for the nulls and tangents. The outside tangents are not needed in this situation - so I deleted them. Position the inside tangents as required. Animate the point nulls.

If you want to keep the timeline less cluttered you could use the 'shy' option to hide the tangent null layers.

If you want to get fancy and control the tangents you could set up simple expressions and sliders to move those nulls in and out relative to their respective anchor point nulls.

-------------------

PS: I'm using Bezier paths here. RotoBezier doesn't have any accessible tangents. What you were doing in your video above was scaling your shape layer - hence the line thickness changing - it was nothing to do with tangents : ) 

Votes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Community Expert ,
Oct 14, 2018 Oct 14, 2018

Copy link to clipboard

Copied

I spent about 10 minutes reviewing these bookmarks I have saved in my Expression Language bookmarks folder:

Managing and animating shape paths and masks in After Effects

Path Property — After Effects Expression Reference 0.0.3 documentation

After Effects tutorial: link path points AND tangents to nulls - No Magnolia

https://media.readthedocs.org/pdf/after-effects-expressions-guide/latest/after-effects-expressions-g...

AExpr Breakdown – After Effects Expressions Tutorials

Then I used the Create Nulls from Paths script and choose Nulls Follow Paths on a simple path with two points and tangents set to zero. This is the expression that it generates:

var nullLayerNames = ["Shape Layer 1: Path 1 [1.1.0]","Shape Layer 1: Path 1 [1.1.1]"];

var origPath = thisProperty;

var origPoints = origPath.points();

var origInTang = origPath.inTangents();

var origOutTang = origPath.outTangents();

var getNullLayers = [];

for (var i = 0; i < nullLayerNames.length; i++){

    try{ 

        getNullLayers.push(effect(nullLayerNames)("ADBE Layer Control-0001"));

    } catch(err) {

        getNullLayers.push(null);

    }}

for (var i = 0; i < getNullLayers.length; i++){

    if (getNullLayers != null && getNullLayers.index != thisLayer.index){

        origPoints = fromCompToSurface(getNullLayers.toComp(getNullLayers.anchorPoint)); 

    }}

createPath(origPoints, origInTang,origOutTang,origPath.isClosed());

It looks kind of complicated but it is actualluy very simple. The first five lines just define some variables that are toing to be used in the Create Paths Medhod directly from the Expression Language Library - createPath(points = [[0,0], [100,0], [100,100], [0,100]], inTangents = [], outTangents = [], is_closed = true). The "for" script just creates a loop that looks for the nulls and and generates an array based on their position and stores that array in the first variable (points 😃 section of the createPath method.

The last line of the expression generated by the script is identical to the createPath method with each of the variables replaced with the definitions above it.

My research let me know that the inTangent and outTangent arguments in the expression return the start and end points of the tangent (handle) for the bezier path. I'm not sure what they do to a rotoBezier path and I haven't tested it. The array comprises the origin of the tangent, (always [0, 0]) and the position of the handle relative to the origin as an array. Paths always have a direction starting from the first vertex so the inTangent is toward the first vertex and the out tangent is away from the first vertex. It took about 5 minutes to create four sliders for the in and out tangent then assign the sliders to the array and edit the last line of the expression. I called the sliders inX, inY, outX, outY and then just put the references in the array for both in and out tangents. The last line was edited to look like this:

createPath(origPoints,inTangents = [[0, 0], [inX, inY]], outTangents = [[outX,outY], [0, 0]],origPath.isClosed());

The first array in the inTangents method is the start of the tangent (vertex) so modifying that property has no effect on the tangent because it always starts at {0, 0]. The same thing goes for the second array in the outTangents method.

Adding the variables for in and out at the top,

inX = effect("inX")("Slider");

inY = effect("inY")("Slider");

outX = effect("outX")("Slider");

outY = effect("outY")("Slider");

and modifying the originInTang and originOutTang properties of the last line was all it took. The final looks like this and would modify all of the in and out tangents equaly no matter how many points there were on a path.

I hope you followed that. If you wanted in and out tangents to be equal you would only need two sliders, one for X and One for Y or a single point control.

If you already used the script all you have to do is add four sliders, rename them, then copy the definitions above and paste them at the head of the Path expression, then copy the modified CreatePath method above and use it to replace the last line in the expression.

Or you can just add and name the 4 sliders and copy and paste this:

inX = effect("inX")("Slider");

inY = effect("inY")("Slider");

outX = effect("outX")("Slider");

outY = effect("outY")("Slider");

var nullLayerNames = ["Shape Layer 1: Path 1 [1.1.0]","Shape Layer 1: Path 1 [1.1.1]"];

var origPath = thisProperty;

var origPoints = origPath.points();

var origInTang = origPath.inTangents();

var origOutTang = origPath.outTangents();

var getNullLayers = [];

for (var i = 0; i < nullLayerNames.length; i++){

    try{ 

        getNullLayers.push(effect(nullLayerNames)("ADBE Layer Control-0001"));

    } catch(err) {

        getNullLayers.push(null);

    }}

for (var i = 0; i < getNullLayers.length; i++){

    if (getNullLayers != null && getNullLayers.index != thisLayer.index){

        origPoints = fromCompToSurface(getNullLayers.toComp(getNullLayers.anchorPoint)); 

    }}

createPath(origPoints,inTangents = [[0, 0], [inX, inY]], outTangents = [[outX,outY], [0, 0]],origPath.isClosed());

Votes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
New Here ,
Dec 06, 2023 Dec 06, 2023

Copy link to clipboard

Copied

LATEST

Thanks Mike, you saved my project 5 years later, that's insane 😉

I created a shape layer with only stroke made of 5 points and wanted to connect only one point to the position of another layer, couldn't find any tutorial on the internet about that, but here you are, thanks a lot man!

Votes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
New Here ,
Oct 14, 2018 Oct 14, 2018

Copy link to clipboard

Copied

Wow thanks you all! This is very helpful.

Votes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Community Expert ,
Oct 14, 2018 Oct 14, 2018

Copy link to clipboard

Copied

The modification of the script I shared will break if there are more than two points i the path. Someday I’ll fix it so it works with multiple points.

Votes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines