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

Linking an object and a text layer's position to the edge of a scaling layer controlled by a slider control.

New Here ,
Sep 16, 2018 Sep 16, 2018

Copy link to clipboard

Copied

I'm creating an animated bar chart and have all the bars and want a little circle on the top of each bar with the number inside and the bar chart starts from 0 and ends up on the number it is. I want the circle and the text to move as the animated bar graph moves as well.

Views

3.8K

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

correct answers 1 Correct answer

Community Expert , Sep 17, 2018 Sep 17, 2018

Let me simplify things for you. Here's an animation preset that will create a column and a circle that are tied together with a slider. There is also an offset slider for the circle so you can position the circle exactly where you want it to be. You can add as many shape layers as you like and position them anywhere. You can change the width of the column, the x position of the circle, or change the size.

Column Marker.ffx

Just download the animation preset, save it to your Custom Animation Preset

...

Votes

Translate

Translate
Guide ,
Sep 16, 2018 Sep 16, 2018

Copy link to clipboard

Copied

This can be done with expressions. If youve never used them before please watch this course which will run through all you need to know;

Check this out on LinkedIn Learning: https://www.linkedin.com/learning/learning-after-effects-expressions?trk=share_ios_course_learning

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 ,
Sep 16, 2018 Sep 16, 2018

Copy link to clipboard

Copied

Hi,

I know about expressions but I just don't know what expression would work in this scenario.

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 ,
Sep 16, 2018 Sep 16, 2018

Copy link to clipboard

Copied

Personally, I would use a shape layer rectangle and animate the size instead of Scale to make it grow. You could declare the x width then tie the height directly to a slider like this:

[100, effect("Slider Control 1")("Slider")]

To make the column grow from the bottom you add this expression to the Rectangle 1 Anchor Point:

[value[0], content("Rectangle 1").content("Rectangle Path 1").size[1]/2]

Then to line up your circles you just tie the Rectangle 1 position to the Ellipse 1 position with this expression:

thisComp.layer("Bar Graph").content("Rectangle 1").transform.position;

To make the circle move with the top of the bar you could use this expression:

x = thisComp.layer("Bar Graph").content("Rectangle 1").transform.anchorPoint[0];

[x, thisComp.layer("Bar Graph").content("Rectangle 1").content("Rectangle Path 1").size[1]]

Repeat for as many circles and bars as you like and you get something like this:

Screenshot_2018-09-16 18.52.19_4c2hbf.png
The logic is pretty simple. You offset the anchor point by half the height so when you animate the slider the base stays put, then you use the changing height to move the circles up and down. The very same expression would be applied to the text layer to keep it in the circle. You could do it all with a couple of shape layers and a text layer for each circle.

You could also use the scale instead of size but the math to convert the sliders to meaningful numbers representing the actual values would be tough.

You could also tie the Source Text directly to the slider and use whatever multiplier you need to generate the right numbers.

I hope this helps.

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 ,
Sep 17, 2018 Sep 17, 2018

Copy link to clipboard

Copied

Hi,

Thanks for the help. One problem I have is that it's a photoshop rectangle so I can't see the size option on the layer.

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 ,
Sep 17, 2018 Sep 17, 2018

Copy link to clipboard

Copied

Also, how do you group all of the bars in the bar chart under one heading called bar graph like you did?

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
Valorous Hero ,
Sep 16, 2018 Sep 16, 2018

Copy link to clipboard

Copied

How are you animating the bars - keyframes, keyframes+Expressions, or with just Expressions?

Motion Graphics Brand Guidelines & Motion Graphics Responsive Design Toolkits

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 ,
Sep 17, 2018 Sep 17, 2018

Copy link to clipboard

Copied

Hi,

I'm using keyframes and expressions too to link it to the slide controller.

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
Guide ,
Sep 16, 2018 Sep 16, 2018

Copy link to clipboard

Copied

A simpler solition;

If your bars are animating already you could just use parenting to attach the circles to the top of each?

Then all you need to do is add the expression to the source text proprty to have the numbers change? You could connect source text directly to the Scale of the layer and then add the linear expression to convert the range of values to the one you need displayed.

By the way, if you know about expressions but have a specific question relating to them, there’s also a dedicated After Effects expressions forum that would be a better place to post this.

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
Valorous Hero ,
Sep 16, 2018 Sep 16, 2018

Copy link to clipboard

Copied

Results will vary depending on how the bars are animated. If it's a child layer and/or if it's scaling up, which is the most often-used method.

Motion Graphics Brand Guidelines & Motion Graphics Responsive Design Toolkits

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 ,
Sep 17, 2018 Sep 17, 2018

Copy link to clipboard

Copied

The problem I get when I try to do that is that the circle also scales alongside the bar but I wanted that to remain the same size.

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 ,
Sep 17, 2018 Sep 17, 2018

Copy link to clipboard

Copied

You can use the same approach that I demonstrated with scale, the math is just a bit more complex.

The mathematical problem you face is calculating the height of the column and turning that into y position. That's why I like using Y size instead of Y scale. There is no conversion.

If you really want to use the Y scale value then you have to convert 100% to the maximum height of your column. If the maximum height of the column was 600px then you could use this expression to determine the Y value for the circle position:

t = thisComp.layer("Column 1").transform.scale[1];

[value[0], value[1] -  linear(t, 0, 100, 0, 600)];

If the maximum value of the column changed you would have to go back to the position argument and change the value.

If around your column and you use the Y scale to change the size of the column the size of the stroke will also change and that limits your design options. It also takes just a bit longer to calculate scale than it does the size of a rectangle. That's a minor consideration unless you have hundreds of columns.

If you have multiple columns you could use the index value of the layers instead of the layer names. layer("Column 1") would become layer(index + 1) and all you would have to do to create new columns with attached circles is duplicate layers.

If you want to use parenting to tie the circle to the top of the column you'll have to throw in an expression that calculates the offset or add an expression that changes the position as scale increases because parenting refers to the position so when you scale the column with the anchor point at the bottom the child layer isn't going to move. You would have to write an expression that would tie the anchor point to the position using Y scale so that the position changes as you change scale.

I've done something similar to what you are doing hundreds of times and have setup animation presets to take care of everything and I think that the expressions I gave you, even if you modify them to use the scale, are the most efficient way to set up your composition.

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 ,
Sep 17, 2018 Sep 17, 2018

Copy link to clipboard

Copied

Hi,

Thanks again. I tried what you were saying and started again with a rectangle shape layer on after effects and an ellipse and the ellipse is going up and down with the rectangle but the problem I'm having is that it's not staying attached and floating just above the top edge. Do you know what I might be doing wrong?

2018-09-17.png

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 ,
Sep 17, 2018 Sep 17, 2018

Copy link to clipboard

Copied

Let me simplify things for you. Here's an animation preset that will create a column and a circle that are tied together with a slider. There is also an offset slider for the circle so you can position the circle exactly where you want it to be. You can add as many shape layers as you like and position them anywhere. You can change the width of the column, the x position of the circle, or change the size.

Column Marker.ffx

Just download the animation preset, save it to your Custom Animation Presets folder, then use the Animation>Apply Animation Preset menu to apply it to a composition and it will create a shape layer like this:

Screenshot_2018-09-17 08.38.15_GmUWSw.png

I didn't take the time to redo your project but this should get you started.

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 ,
Sep 17, 2018 Sep 17, 2018

Copy link to clipboard

Copied

LATEST

Thanks very much for all the help. I ended up using that scaling idea instead.

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