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

How to proportionally move nodes on a line

New Here ,
Oct 01, 2020 Oct 01, 2020

Copy link to clipboard

Copied

I have a set of data in which the values need to remain constant.

numberPlot.png

Later in the project, I need to zoom into the bunched up values towards the left so that they fit the full width of the graph, so that they can be more easily distinguished and labeled. I'm struggling with how to best acheive this while keeping the size of the nodes the same and preserving the distance between them.

 

This graph was made in Illustrator, but can easily be made in AE if it makes the process simpler/easier.

TOPICS
How to

Views

131

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 01, 2020 Oct 01, 2020

Copy link to clipboard

Copied

LATEST

I would create the whole thing on a single shape layer and use a common expression for all of the circles that set the position of the ellipse based on the length of the line the colored circles are on. The math is relatively straightforward. 

 

Start a new shape layer and create a rectangle that is centered, the width of the comp, and about 4 pixels high. Add an expression slider to the comp and name it Line Length. Rename Rectangle 1 to Baseline Rectangle. Add this expression to the Baseline Rectangle/Rectangle 1 Path/Size and when the slider is set to 100(%) the rectangle will be as wide as the comp:

 

 

lineLen = effect("Line Length")("Slider") * .01;
newWidth = width * lineLen;
[newWidth, 4]

 

 

Now add an ellipse to the shape layer, zero out all of the Ellipse 1 transforms so that it is in the center of the comp splitting the Baseline Rectangle. Add this expression to the Ellipse 1/Ellipse Path 1/Position. The first line of the expression sets the ellipse (the circle) position as a percentage of the total line length.

 

 

pointPosition = 6; // placement as a percentage of the line
barLength = content("Baseline Rectangle").content("Rectangle Path 1").size[0];
barStart = - barLength / 2;
xPosition = barLength * pointPosition;
xOffset = pointPosition * barLength * .01;
[barStart + xOffset, value[1]]

 

 

Now duplicate the ellipse as man times as you need data points, edit the fill colors as needed, and set the pointPosition value to the appropriate percentage. 

 

You will end up with a single shape layer that contains the entire line graph and you can size the line to any length you want and the points will stay in the same relative position. The comp looks something like this:

Bar Graph.gif

Here's a project file for you to play with. You could fancy it up and use a JSON file to drive the pointPosition value to automate it.

 

This is just one of the presets and tools that will soon be available for purchase. Enjoy.

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