Class Central is learner-supported. When you buy through links on our site, we may earn an affiliate commission.

YouTube

Create a Tapered Stroke in After Effects - Part 2

School of Motion via YouTube

Overview

Save Big on Coursera Plus. 7,000+ courses at $160 off. Limited Time Only!
Continue building a tapered stroke rig in After Effects in this second part of a video tutorial series. Learn how to add advanced features like reversing the taper direction and creating independent tapers from the center. Follow along step-by-step to implement conditional statements and checkbox controls that enable these new capabilities. Gain a deeper understanding of expressions and how to leverage them to create a more versatile and powerful stroke animation tool in After Effects.

Syllabus

Music : [intro music]
Jake Bartlett : Hey, it's Jake Bartlett again for school of motion. And this is lesson two of our tapered stroke rig using expressions. Now, if you made it through chapter one of this lesson, you should already have a pretty good grasp on how all of the expressions we need for this rig are working. We'll add more complexity to the rig, but it will also unlock a lot of extra features. The good news is there's a lot of repetition to this process. So even if it's a little bit confusing at first, just keep following along and it should start to click. All right. So to start just open up the project file that we had from the previous lesson, this one is exactly the same. All I've done is modified the path so that we have this nice curve here. So I thought of some extra features that would make this tapered stroke rig a lot more useful.
Jake Bartlett : The first thing I thought of was just the ability to reverse the taper. So the thick end is on this side and tapers out in the opposite direction. Another great thing to have would be the ability to taper from the center and taper either end independently. So let's jump right in and take a look at how we could make those two features a reality. I'll start by adding a new expression control. So come up to effects, expression controls, and then checkbox control. Now a checkbox control is just that it's a checkbox that you can turn on or off. So the values that they return are zero for off and one for on. And we can use that in combination with some new expressions to enable or disable that reverse taper. So let's start by renaming. This checkbox control reverse taper, and the way that the reverse taper will actually work is by reversing the order of the stroke with offset.
Jake Bartlett : And if you remember, when we first built this taper, the original equation we wrote for the duplicate groups, stroke width was tapering in the opposite direction. So we already kind of know how to make this work. I'm going to delete all these duplicate groups and open up the taper ones, stroke I'll load the stroke with the equation. And if we take a look at the variable for the stroke taper, remember that we put this in parentheses, total groups minus the group index to get the taper, to go in the right direction. But if I duplicate this variable and give it a new name, say reverse stroke taper, and then take off this total groups minus and the parentheses around it. That equation should give us the taper in the opposite direction. But how do we get that variable to come into effect when this reverse taper is checked?
Jake Bartlett : Well, we need to use, what's called a conditional statement. And a conditional statement is just another type of expression that you can set conditions for. And if those conditions are met, one line of code will happen. And if those conditions are not met, it moves on to the next line of code that might've been really hard to take in. So let's just start writing it so you can see exactly how it works. I'll drop down one line and start writing my statement. So a conditional statement always starts with an F and then it open parentheses. Now my condition is going to be based off of the reverse taper checkbox, but I don't have any way to reference that yet. So I need to define it as a variable. So I'll come back up here and type VAR reverse taper equals I'll find that reverse taper, checkbox control and pick whip it, then close that out with a semi-colon and now it can reference that.
Jake Bartlett : So if the reverse taper equals one and in a conditional statement, the syntax for equals is actually two equal signs together. And one is the value when the checkbox is checked. So if the reverse taper is checked, then I'll go outside of the parentheses and add an open curly bracket. Expressionist automatically generates the closing curly bracket because it knows that I'm going to need that at the end of whatever is contained within it. Then I'm going to press enter to drop down a line. And again, expressionist has done something for me. It's indented my line, which is the same as pressing tab. And it's dropped that curly bracket down one more line. So these are all time-saving functions of expressionists. And when you're writing a lot of code every little bit helps, none of these features are available in after effects, native expression editor, but why do I need this indentation and this curly bracket on the next line?

Taught by

School of Motion

Reviews

Start your review of Create a Tapered Stroke in After Effects - Part 2

Never Stop Learning.

Get personalized course recommendations, track subjects and courses with reminders, and more.

Someone learning on their laptop while sitting on the floor.