Copy link to clipboard
Copied
Greetings,
I use Adobe Aftereffects to create dozens of charts and graphs for corporate presentations. Every month I rework 30+ PowerPoint charts and graphs, animate them, and include them in a video. I have been able to successfully recreate one example of each of the types of graphs I need, then I just reuse them when necessary by simply changing the data. I am having problem figuring out how to best create this one last type of graph. Here are the main details about the graph:
* This is to be a combination vertical bar & line graph with only three observation points
* At the top of each bar there is a circle/dot (the diameter of the bar) containing the data value represented by the bar.
ANIMATION TO BE APPLIED
As the vertical bars rise to their respective heights, the attached circles directly above the bars should also rise as the data (inside the DataDots/circles) "calculate" and eventually stop when the bar stops after reaching its full heigt. This is what I have used so far:
* Trim Paths to create the bars
* "Linear" expression to define minimum and maximum data values
* Slider Controls to input bar value data
* A Null to link each of the three DataDots above the bars along with the data values of each bar which is centered in the middle of each DataDot.
Everything works find except for onee problem. I need to have each DataDots move in concert with the animated bar as it rises to its final height. I know how to link objects to a Nulls and I have already linked the DataDots and their corresponding values to a null, but how can I link the null to an object (each vertical bar)? Linking the null to the top of the vertical bar would be ideal but After Effects will not allow me to do that. Using PickWhip to link the "Position" property of the vertical bar to the "Position" property of the Null Layer fails.
CONCLUSION:
(1) Is there a way to link a Null to an object (not the other way around)?
(2) Is there another way to design this graph in such a way so that the large DataDots (and data values) at the top of each vertical bar, move in unison with each bar as they rises to their eventual height? Thank you in advance for contemplating this.
Copy link to clipboard
Copied
Because you're using Trim Paths to expand or "grow" your graph bar, parenting your dot to the bar won't work, because you're not using a standard transform function (like Position) to expand the column. You could almost certainly create expressions that mathematically synchronise the position of the dot over the trimmed shape layer, but I think it may be over-complicating the problem.
If you create the bar with a layer (probably a solid) that is matted at the base of the graph, you can simply "grow" the bar by moving it's position upward, revealing the bar as it moves above the matte. Use your slider expression to "grow" the bar using the position parameter.
Now, because you're using Position as the tool to grow the bar, you can simply parent the dot to the bar.
Copy link to clipboard
Copied
Hmm . . . What is the advantage to using a Solid (as you described above) vs a Shape Layer containing a rectangle?
Copy link to clipboard
Copied
Sorry, didn't mean to imply using a Solid had any advantage, just me being old school more than anything. You can use any layer, including a Shape layer, as the bar. But, as I said in my earlier repsonse, you need to move the Position of that bar in order to tie it to your other layer using parenting, unless you want a significantly more complex set of expressions to calculate what you require.
Rick's post highlights the latter - obviously a far more robust and impressive solution, but also more complex. My simple explanation is better highlighted with this very simple solution - two pickwhipped expressions is the total job.
Copy link to clipboard
Copied
For Bar Graphs, I always use Shape layer Rectangles. I tie the Rectangle/Transform Rectangle/Anchor point to the Rectangle height and use linear interpolation to turn my changing data into the appropriate bar height (or length).
I use Trim Paths on a shape layer path to animate line graphs. Tying another shape, like an Ellipse for a dot at the end of the graph, is also controlled with a simple linear expression that ties the shape layer path to the motion path with an interpolation method.
I also use the Create Nulls From Paths/Points follow Nulls script to tie points on a line graph to values from a CSV file or a bunch of sliders.
Here is how I would set up a bar chart with a ball above the bar that follows the growing value and even put a text layer in the middle of the ball to display values. In this sample, I use a slider to control each rectangle, and everything else is tied to the height of the rectangle. If I want the graph range to be from 0 to 750, then I set up the Rectangle 1 Size like this:
v = effect("1")("Slider");
t = clamp(v, 0, 75);//maximum slider value
h = linear(t, 0, 75, 20, 600);
w = 100;
[w, h]
This gives me a comfortable range for the slider. If the graph is supposed to represent 521, I set the slider value to 52.1.
To make the rectangle grow from the bottom, I set up Rectangle 1/Transform Rectangle 1/Anchor point like this:
y = content("Rectangle 1").content("Rectangle Path 1").size[1]/2;
[0, y]
To make an ellipse match the width of Rectangle one, a simple pickwhip expression from Ellipse 1/Size to the X size value of Rectangle 1 gives you this:
temp = content("Rectangle 1").content("Rectangle Path 1").size[0];
[temp, temp]
To position the ellipse I subtract the size of the circle multiplied by about .75 and the height of the bar from the postition of the bar like this:
p = content("Rectangle 1").transform.position;
h = content("Rectangle 1").content("Rectangle Path 1").size[1];
pad = content("Ellipse 1").content("Ellipse Path 1").size[1]*.75;
[p[0], p[1] - h - pad];
You can add a couple of other expressions to space out multiple Rectangles and Ellipses, and you can even use the Rectangle/Transform Rectangle/Position in conjunction with the Shape Layer position to center a text layer in the circle.
I've uploaded a sample comp (AE 22) for you to look at.
If you use property links instead of property names in the expressions, you don't need to worry about shape names; the whole thing can be streamlined. That's how I usually do it, but using content("Shape Name") makes the math a little easier to understand.
I hope this helps.
By the way, I never use solids for this kind of animation.
Copy link to clipboard
Copied
Thank you both Rick and Andrew. This is exactly what I am trying to replicate. I will use both your approaches and build two seperate models to see which one is easier to update in the future when I need to simply change data values (and minimum and maximum ranges). At the very least I see the need to better understand scripting/expressions. Thank you both again for such detailed expressions.