Animating Graph Percentage Bars with Expressions and Keyframes in After Effects

Animate a percentage text by linking its source text to a slider control on a null layer using an expression.

Animate dynamic percentage values in After Effects using expressions instead of manually creating dozens of keyframes. Learn how to link text layers to animated slider controls on a null object to streamline your motion graphics workflow.

Key Insights

  • Instead of manually keyframing text percentages, you can animate a text layer's source text property by linking it to a slider control using expressions, simplifying the process of creating smooth number transitions.
  • Adding a slider control effect to a null object allows you to centralize and manage numeric animations, which can then be referenced by expressions in other layers such as text elements.
  • Right-aligning the text ensures that digits and accompanying symbols (like percentage signs) remain visually consistent as the number increases, preventing layout shifts during animation.

This lesson is a preview from our After Effects Certification Course Online (includes software & exam). Enroll in a course for detailed lessons, live instructor support, and project-based training.

This is a lesson preview only. For the full lesson, purchase the course here.

So, I'm working currently on the graph percentage bars comp. I have previously created the rings and I have animated the bars growing around the edge. Currently, I have the reference layer hidden.

I didn't delete it in case I need it for something else. So again, if I need to recreate this or if I made something wrong, I need that reference there. It's just easier to keep it here.

So I just turned off its visibility, clicking off its eye. No problem at all. But now it's time to animate these numbers and this is where it gets a little interesting.

So, a text layer has text properties and transform properties. Transform is position, rotation, scale, that sort of thing. The standard transform properties every visible layer has.

But the text property is where it gets interesting because it has path options. It's what allowed us to curve the wingdings text around the mask we drew on it. It's also got more options, which are additional text properties, okay? But it also has source text and source text is interesting because it's a text itself.

So, if I was turning the stopwatch for source text, I get a keyframe. Let's say I go to two seconds, for example. Let's say I go to two seconds right here.

I'm just going to double click on the text and type a different number. Let's say I type 70% new keyframe. So, the program basically does is holds the previous keyframe until the next one and then it immediately flips off, okay? Now, I'm going to undo that because I don't want to have to make, if I want to animate, let's say 0% to 100%, I don't want to have to make like 100 keyframes.

That'd be annoying, okay? There's got to be an easier way and there is. We can actually use an expression to link the source text of this layer to something else that's happening, something that's animating, something that's changing. That's my idea, okay? That's what this little link spiral does.

It lets me link this property to anything else that exists, okay? So, for example, I could link it to a layer that I'm animating and have it change the value as that animation occurs and that's what we're going to do here. So, I am going to adjust the property of this for paragraph to be right aligned and then it's going to recenter that, okay? So, when the number changes, when it goes from like one digit to two to three, if I don't have it right aligned, you're going to see the percentage sign move left and right. So, I want to basically anchor this right side so when the numbers change, it's not going to push the percentage sign anyplace else.

That's just my goal. I think that looks actually nice. Now, I need to make a layer for the animation that I can link source text to.

Now, you could make any layer animate a property on it, but I want to use something specifically designed for this situation and that layer new, I'm going to make a null. I'm going to call the null counter, okay? Now, okay, the null itself is not a property I'm going to animate. The null is simply going to exist to hold a specific effect.

So, if I go to effects and presets, these are all my lists of effects and one of them is actually called expression controls. This group exists basically to control parts of an expression. That's it.

That's all they exist for. They're added usually to null layers and they're used to link expression properties. So, there's a whole bunch of them.

Controls, angle controls, that sort of thing. I could do an angle control. That's not bad actually, but specifically, I think a slider control is the best bet.

So, I'm just going to double click to add that to counter. Now, if I want to, I can rename the slider control to whatever I please, but I'm just going to rename it to scaling animation. Scaling animation.

You call it Bob while it cares, by the way. Like that. Describe what it does.

And I'll make two keyframes to it. So, slider, first keyframe will be zero and let's do this over two seconds, I think. Two seconds, there's only two seconds.

It'll be 100. Okay, so I'll just type it in. So, basically, that number now changes over time from zero to 200.

And if I actually open the property, I'll just press U to reveal the property. You can see the number change. So, it's like there, there, there, there, there, there, there, there, there, 100.

Okay, I need the property, so I can do this. So, I'm looking at the text layers source text property. I'm looking at the slider that is animated slider property.

I'm going to use a little property pick whip here and slide it onto slider. Just click and drag. Okay, it made an expression, added an expression.

I'll open this little arrow so I can see it. I'm going to make the expression text field window larger and it wrote that. Now, what is that saying? It's saying the property for source text, the value of source text is the slider, which is inside of scaling animation, which is an effect on the layer named counter in this comp.

Jerron Smith

Jerron has more than 25 years of experience working with graphics and video and expert-level certifications in Adobe After Effects, Premiere Pro, Photoshop, and Illustrator along with an extensive knowledge of other animation programs like Cinema 4D, Adobe Animate, and 3DS Max. He has authored multiple books and video training series on computer graphics software such as: After Effects, Premiere Pro, Photoshop, Illustrator, and Flash (back when it was a thing). He has taught at the college level for over 20 years at schools such as NYCCT (New York City College of Technology), NYIT (The New York Institute of Technology), and FIT (The Fashion Institute of Technology).

More articles by Jerron Smith

How to Learn After Effects

Build practical, career-focused skills in After Effects through hands-on training designed for beginners and professionals alike. Learn fundamental concepts, tools, and workflows that prepare you for real-world projects or industry certification.