Вы находитесь на странице: 1из 44

Tapering A Stroke with Expressions in After E ects Part 2

Share  

subtitles settings

subtitles off

en

Overview Q&A Transcripts

00:00:00,879 (light instrumental music)

00:00:15,464 (upbeat instrumental music)

00:00:23,446 - [Instructor] Hey, it's Jake Bartlett again

00:00:24,637 for School of Motion, and this is Lesson Two

00:00:27,200 of our tapered stroke rig, using expressions.

00:00:30,797 If you made it through Chapter One of this lesson,

00:00:32,580 you should already have a pretty good grasp on how all

00:00:35,296 of the expressions we need for this rig are working.

00:00:38,475 We'll add more complexity to the rig, but it will also

00:00:41,104 unlock a lot of extra features.


00:00:43,788 The good news is there's a lot of repetition

00:00:45,625 to this process.

00:00:46,989 So even if it's a little bit confusing at rst,

00:00:49,573 just keep following along, and it should start to click.

00:00:53,609 Alright, so to start, just open up the project le

00:00:55,932 that we had from the previous lesson.

00:00:58,385 This one is exactly the same.

00:01:00,133 All I've done is modi ed the path so that we have

00:01:02,685 this nice curve here.

00:01:04,788 So I thought of some extra features that would make this

00:01:06,865 tapered stroke rig a lot more useful.

00:01:09,901 The rst thing I thought of was just the ability

00:01:11,783 to reverse the taper.

00:01:13,376 So, the thick end is on this side, and tapers out

00:01:16,272 in the opposite direction.

00:01:18,460 Another great thing to have would be the ability to taper

00:01:21,133 from the center, and taper either end independently.

00:01:25,104 So let's jump right in, and take a look at how we could

00:01:27,184 make those two features a reality.

00:01:30,264 I'll start by adding a new expression control.

00:01:32,814 So come up to e ects, expression controls,

00:01:35,708 and then checkbox control.

00:01:39,613 Now a checkbox control is just that.

00:01:41,736 It's a checkbox that you can turn on or o .

00:01:44,519 So the values that they return are zero for o ,

00:01:48,489 and one for on.

00:01:50,548 And we can use that in combination with some new


00:01:52,604 expressions, to enable or disable that reverse taper.

00:01:56,475 So let's start by renaming this checkbox control

00:01:58,939 reverse taper.

00:02:02,523 And the way that the reverse taper will actually work

00:02:04,781 is by reversing the order of the stroke width o set.

00:02:08,642 And if you remember, when we rst built this taper,

00:02:11,352 the original equation we wrote for the duplicate groups'

00:02:14,541 stroke widths was tapering in the opposite direction.

00:02:18,941 So we already kind of know how to make this work.

00:02:22,295 I'm gonna delete all these duplicate groups,

00:02:24,332 and open up taper01's stroke.

00:02:27,776 I'll load the stroke width equation.

00:02:30,448 And if we take a look at the variable for the stroke taper,

00:02:33,129 remember that we put this in parentheses.

00:02:35,872 Total groups minus the group index,

00:02:38,125 to get the taper to go in the right direction.

00:02:40,932 But if I duplicate this variable ...

00:02:45,176 And give it a new name, say, reverse stroke taper ...

00:02:51,844 And then take o this total group's minus

00:02:55,692 and the parentheses around it.

00:02:57,387 That equation should give us the taper in

00:02:59,674 the opposite direction.

00:03:01,171 But how do we get that variable to come into e ect

00:03:04,417 when this reverse taper is checked?

00:03:07,442 Well, we need to use what's called a conditional statement.

00:03:10,642 And a conditional statement is just another type

00:03:12,490 of expression that you can set conditions for,


00:03:15,682 and if those conditions are met, one line of code

00:03:17,970 will happen, and if those conditions are not met,

00:03:20,466 it moves on to the next line of code.

00:03:22,916 That might have been really hard to take in.

00:03:24,841 So let's just start writing it, so you can see

00:03:27,140 exactly how it works.

00:03:29,155 I'll drop down one line, and start writing my statement.

00:03:32,928 So a conditional statement always starts with an if.

00:03:36,602 And then an open parentheses.

00:03:39,471 Now my condition is going to be based o of the

00:03:41,299 reverse taper checkbox.

00:03:42,762 But I don't have any way to reference that yet.

00:03:45,314 So I need to de ne it as a variable.

00:03:47,922 So I'll come back up here, and type VAR

00:03:50,826 reverse taper, equals ...

00:03:54,521 I'll nd that reverse taper checkbox control,

00:03:57,361 and pick whip it.

00:03:59,913 Then close that out with a semicolon.

00:04:02,365 And now I can reference that.

00:04:03,553 So, if the reverse taper

00:04:08,282 equals one ...

00:04:11,438 And in a conditional statement, the syntax for equals

00:04:14,309 is actually two equal signs together.

00:04:17,390 And one is the value when the checkbox is checked.

00:04:21,297 So, if the reverse taper is checked, then I'll go outside

00:04:25,433 the parentheses, and add an open curly bracket.

00:04:30,667 Expressionist automatically generates the closing curly


00:04:33,353 bracket, because it knows that I'm going to need that

00:04:35,340 at the end of whatever is contained within it.

00:04:38,941 Then I'm going to press enter, to drop down a line,

00:04:41,964 and again Expressionist has done something for me.

00:04:44,485 It's indented my line, which is the same as pressing tab,

00:04:48,565 and it's dropped that curly bracket down one more line.

00:04:52,411 So these are all time saving functions of Expressionist.

00:04:55,153 And, when you're writing a lot of code,

00:04:57,045 every little bit helps.

00:04:58,841 None of these features are available in After E ects'

00:05:01,117 native expression editor.

00:05:02,954 But why do I need this indentation and this curly bracket

00:05:05,984 on the next line?

00:05:07,375 Well, when you're writing code, things can get very messy,

00:05:11,367 and very hard to look at.

00:05:13,183 And, using this type of indentation, and the placement

00:05:16,195 of these containers, makes everything much more organized

00:05:20,243 and easy to look at.

00:05:21,936 So for example, conditional statements have a hierarchy,

00:05:25,083 which looks like this.

00:05:26,370 You start with an if statement, and the condition.

00:05:30,306 Then you have a line of code for whatever you want

00:05:33,096 that value to be.

00:05:35,045 If that condition is met, and you close that o

00:05:37,827 with a curly bracket, then we would type ...

00:05:40,953 Else, and then another curly bracket,

00:05:45,221 drop down another line, indent.


00:05:47,849 And then the second line of code that you would want

00:05:49,676 to happen, if that condition isn't met.

00:05:52,900 So else is basically saying otherwise, if that condition

00:05:55,802 is not met, do this.

00:05:58,840 So one more time, the basics of the conditional statement

00:06:01,292 is, if something is true, do this.

00:06:05,065 Otherwise, do this.

00:06:07,661 So what do we want to happen if the reverse

00:06:09,013 taper is checked?

00:06:10,817 Well I want a similar equation to what we already had,

00:06:14,381 so I'll copy and paste that inside that curly bracket.

00:06:18,405 Another feature of Expressionist I want to point out

00:06:20,265 really quick, is you see that when I have my cursor right

00:06:23,137 after a curly bracket, or any type of container,

00:06:26,713 the corresponding closing or opening container

00:06:30,189 is highlighted blue.

00:06:32,057 So I know that everything between these two highlighted

00:06:34,983 brackets is what's included in this conditional statement.

00:06:38,613 Same thing is true for these parentheses.

00:06:40,429 If I click on that, both of the parentheses light up blue.

00:06:43,697 So, that's super handy.

00:06:45,783 Alright, back to our equation.

00:06:47,412 If reverse taper is checked, we want to do the same

00:06:49,537 linear equation, but instead of tapering to the stroke

00:06:53,309 taper variable, we want to go to the reverse

00:06:56,861 stroke taper variable.

00:06:58,645 So I will write that in, reverse stroke taper.


00:07:04,099 Otherwise, if reverse taper is not checked,

00:07:07,005 then I want to do my regular equation.

00:07:09,039 So I'll cut and paste that in between

00:07:11,581 these two curly brackets.

00:07:13,681 And that nishes o the conditional statement.

00:07:16,477 So let's apply this to the stroke width

00:07:18,157 of the duplicate group.

00:07:20,249 And then I'll make a bunch of duplicates ...

00:07:23,184 And we'll see what happens when I turn the

00:07:25,913 reverse taper checkbox on.

00:07:28,760 Well for the most part, it's working.

00:07:30,513 It looks like that taper has been reversed.

00:07:32,733 The problem is that master group at the end there

00:07:36,497 hasn't changed at all.

00:07:37,969 And that's because the master stroke width doesn't have

00:07:40,477 any of that conditional expression applied to it.

00:07:43,513 So we need to go add that conditional statement.

00:07:45,857 So, I'll just load that up.

00:07:48,321 And this value's just being driven directly

00:07:50,289 by the stroke width slider.

00:07:52,313 So let's de ne this slider as a variable.

00:07:54,933 So VAR stroke width equals ...

00:07:58,923 Then that e ects slider.

00:08:00,772 Next we're going to need some variables that

00:08:02,929 we've already de ned other places.

00:08:04,789 So I'm just gonna open up the stroke width for the duplicate

00:08:07,967 group, and we're going to need the taper out.


00:08:12,543 So I'll copy that and paste it.

00:08:15,303 We're going to need the total groups.

00:08:18,253 So I'll copy that,

00:08:20,299 and paste it.

00:08:21,928 And then we're gonna need the reverse taper checkbox.

00:08:24,093 So let's copy that.

00:08:28,001 And now we should be able to write

00:08:28,834 our conditional statement.

00:08:30,377 So let's drop down, and start again by typing if,

00:08:34,740 open parentheses, reverse taper, equals ...

00:08:40,629 And again, you have to put two equals signs

00:08:42,521 to represent equals.

00:08:44,551 One, which again, just means that the checkbox is checked.

00:08:49,171 Zero is unchecked, one is checked.

00:08:52,076 And I'll go outside the parentheses,

00:08:53,903 and type my open curly brackets.

00:08:57,215 Enter down and indent.

00:08:59,349 So if reverse taper is checked, then this happens.

00:09:03,377 So what happens?

00:09:04,773 Well, we need to use linear interpolation.

00:09:07,193 So, linear, parentheses ...

00:09:11,152 And we need to look at the taper out slider,

00:09:15,013 comma, with a range of zero to 100,

00:09:20,600 interpolated to a range of stroke width

00:09:25,528 to stroke width divided by total groups.

00:09:31,641 And end that all with a semicolon.

00:09:34,577 So when the taper out is set to zero, we want the stroke
00:09:37,869 width, and when it's set to 100, we want it to be

00:09:40,245 the stroke width divided by the total groups.

00:09:42,860 Nothing really new in that equation.

00:09:45,281 Then we'll drop down after this curly bracket,

00:09:47,424 and say else, open curly bracket.

00:09:51,165 Drop down and indent.

00:09:52,917 Stroke width ...

00:09:55,621 Which is the same as what we had before we just wrote

00:09:57,713 this a conditional statement.

00:09:59,737 So let's look at this one more time.

00:10:01,673 If the reverse taper is checked, do this.

00:10:06,473 Otherwise, do this.

00:10:09,421 Simple as that.

00:10:10,717 Let's go down to our stroke width for the master group,

00:10:13,457 and apply it.

00:10:15,239 And just like that, our stroke width now ts

00:10:17,238 at the tail end.

00:10:18,945 Now, something strange is happening.

00:10:20,916 If I turn on multiply for all of the duplicate groups,

00:10:23,938 you'll see that the last duplicate group is 28 pixels wide,

00:10:29,065 but so is the master group.

00:10:32,355 And that's because we accounted for this extra master group,

00:10:36,481 in the variable for the total groups within

00:10:38,857 the duplicate stroke widths.

00:10:40,672 So let me load that up, and show you.

00:10:43,081 Right there, at the end of total groups,

00:10:45,063 we added one to compensate for the fact that


00:10:48,659 the taper should be starting with the master group.

00:10:52,479 So to x that, all we have to do is add a one to

00:10:56,691 the group index on this reverse stroke taper equation.

00:11:02,018 So if I just put group index within parentheses ...

00:11:07,462 And then add plus one after group index,

00:11:11,390 that will automatically increase the group index of every

00:11:14,654 group, when the reverse stroke taper comes into play.

00:11:18,934 So, that should solve the problem.

00:11:20,324 Let's apply that to the duplicate.

00:11:23,360 Delete all of the other duplicates,

00:11:25,396 and then reduplicate that group.

00:11:28,464 (laughs) And this is a process we'll be doing a lot

00:11:30,345 through this lesson, so just bear with me.

00:11:32,756 It's a lot of back and forth, of deleting groups,

00:11:34,874 and then reduplicating.

00:11:36,308 Alright, so, now that looks like it's working.

00:11:39,508 I'll get rid of all the multiplies.

00:11:42,830 And now you can clearly see that the master group

00:11:45,888 is as di erent stroke width than the group before it.

00:11:49,144 And if I uncheck the reverse taper,

00:11:51,672 the taper goes back to normal.

00:11:53,365 So that is functioning exactly the way that we need it to.

00:11:56,553 Awesome!

00:11:57,521 On feature down.

00:11:58,566 And we just learned the basics of conditional statements,

00:12:01,074 which is really what we'll been using for all of the other

00:12:03,582 features that we're going to to implement into this rig.


00:12:06,423 So if that went a little bit over your head, don't worry.

00:12:08,799 We're gonna be using a lot of di erent conditional

00:12:10,702 statements, so if you don't already have the hang of it,

00:12:13,252 you probably will by the end of this lesson.

00:12:16,167 Alright, so next we want to taper the stroke on

00:12:18,775 either end independently from the center.

00:12:22,292 So I'm gonna need another checkbox.

00:12:24,879 I'll duplicate this one and name it taper in/out.

00:12:31,215 And then I'll need another slider, so I'll duplicate

00:12:33,615 this taper out and rename it taper in.

00:12:39,323 Now there are a lot more things you can do with

00:12:40,886 conditional statements than just checking to see

00:12:43,239 if a checkbox is enabled.

00:12:45,228 And we're gonna have to get a little bit more complex

00:12:47,363 to make this taper in and out function.

00:12:50,742 But again, it's going to be based on the stroke width,

00:12:53,403 so we can keep working on this same expression.

00:12:55,855 We need to add in variables for the new controllers

00:12:58,023 that we just made.

00:12:59,190 So, I'll type in VAR taper both, for the taper in and out.

00:13:05,262 So I'll nd that checkbox,

00:13:08,002 pick whip, semicolon.

00:13:10,530 And then we need a variable for the taper in.

00:13:12,859 So I will just copy and paste this expression,

00:13:15,526 and then just by hand, update it to be taper in.

00:13:19,530 And then the name of that slider is taper in.

00:13:23,212 So that's all I have to do to de ne that variable.


00:13:25,954 And we're going to add another condition to our expression.

00:13:29,944 So right now we just have a single if statement.

00:13:33,126 And then a nal else statement.

00:13:36,326 But, if I drop this else statement down one line,

00:13:40,197 I can write another curly bracket to close o

00:13:42,782 the expression above it, and type else if,

00:13:47,778 and start writing another condition.

00:13:50,174 So that's exactly what I'll do.

00:13:51,647 I'll type parentheses, and this condition is going

00:13:54,850 to be based on the taper in and out checkbox.

00:13:57,918 So, taper, both, equals, one.

00:14:03,606 So if the taper both is checked, then,

00:14:07,684 drop down an indent ...

00:14:09,808 And I actually don't need this second curly bracket,

00:14:12,492 because I've already got one on the next else statement.

00:14:16,385 And if I left that extra curly bracket in there,

00:14:18,520 it would mess up the conditional statement.

00:14:20,212 So I'm gonna get rid of that one,

00:14:22,523 bring that back up, and go to my indented line.

00:14:25,963 So, if taper both is checked, then what needs to happen?

00:14:30,180 Well, here's where we're gonna get clever,

00:14:31,961 and even a little bit more complex.

00:14:34,281 You don't have to just write a single equation

00:14:37,138 as a result of a condition.

00:14:39,100 You can actually put a condition within a condition.

00:14:42,696 Some might say it's an "expressionception".

00:14:45,765 Alright, that was terrible.


00:14:46,865 But let's go ahead and write another condition,

00:14:49,264 within this condition.

00:14:50,684 So, I will start by saying if, just like normal.

00:14:54,269 Open parentheses, and then the condition I want to know

00:14:57,689 is if the group index, for the group this expression

00:15:00,832 is contained in, is greater than the total groups

00:15:06,617 divided by two ...

00:15:09,180 Or in other words, half of the total groups.

00:15:12,392 Then, I want something to happen ...

00:15:15,086 Else, or otherwise, I want something else to happen.

00:15:19,629 So let's take a look at this condition.

00:15:21,445 The reason why this is a clever expression is because

00:15:23,689 it's going to be based on what the group index is that

00:15:27,233 the expression is written on.

00:15:29,136 So depending on where the group is in this stack,

00:15:31,929 one thing will happen.

00:15:33,435 And if it's in another location, another thing will happen.

00:15:36,209 So one half of this line is going to be a ected by

00:15:39,928 the rst line, and the other half will be a ected

00:15:42,017 by the other line.

00:15:44,152 So what do we want to happen on the groups that are

00:15:45,868 an index value greater than half of the groups?

00:15:49,551 Well let's make sure we know which groups those are.

00:15:52,321 Taper 01 should be an index value of 11,

00:15:56,104 because there are ten duplicate groups, plus one.

00:16:00,107 Right here, we've got plus one,

00:16:01,881 to account for that master group.


00:16:04,345 So, taper one should be a value of 11.

00:16:07,128 So yes, that is greater than half of the total groups.

00:16:10,921 So group one is on this tail end.

00:16:13,825 So if taper both is checked, we want the taper to go

00:16:16,827 in the same direction for that half of a line.

00:16:20,625 So really, I can just copy the expression for

00:16:22,472 the regular taper, and paste that into that section.

00:16:26,893 If the group index is not greater than half the total

00:16:29,612 groups, then I want it to taper in the other direction.

00:16:33,540 Or, reverse the taper, which I have the line of code

00:16:36,652 for right up here.

00:16:38,181 So I'll just copy and paste that.

00:16:40,885 And we can apply that to the stroke width.

00:16:44,162 Then I'll delete all of the duplicates, reduplicate them,

00:16:47,397 and then enable the taper in and out.

00:16:52,788 Now, it's kind of working.

00:16:54,415 Again, the master group is outside of these expressions,

00:16:57,925 so it's not being a ected by it.

00:17:00,137 So I'm just going to shut it o for now.

00:17:02,645 And, it actually does look like it's tapering

00:17:05,041 from the center on to both ends.

00:17:08,297 There are a few issues.

00:17:10,037 Number one is that if I adjust the taper in slider,

00:17:13,645 nothing is happening.

00:17:15,404 And if I adjust the taper out, it's a ecting

00:17:18,153 both ends at the same time.

00:17:20,652 Now, that is because when I copied and pasted these


00:17:23,634 expressions from the reverse taper and the regular taper,

00:17:26,945 I did not update the linear expression to target

00:17:30,782 the taper in, instead of the taper out.

00:17:34,388 So I'll take this linear equation and change

00:17:36,853 taper out to taper in.

00:17:40,014 Now if I reapply that, that should x the problem.

00:17:43,806 I'll delete these groups, and reduplicate.

00:17:49,682 And there we go, now that slider is a ecting the rst

00:17:53,002 half, and the taper out slider is a ecting the second half.

00:17:57,118 That's great, it's working the way that it should.

00:17:59,726 But, there is another issue.

00:18:02,190 When these two numbers aren't the same, you see that

00:18:05,063 they don't ow together very nicely in the middle.

00:18:08,565 Now the reason this is happening is because the way that

00:18:11,707 this expression is dividing the groups in half,

00:18:15,042 we're basically cutting the number of groups

00:18:16,547 for each taper in half.

00:18:19,530 So if I disable this, you see that the taper

00:18:21,739 keeps getting larger.

00:18:23,292 And when I check it, it leaves this part of the taper

00:18:26,407 the way it was, and shrinks down the front half

00:18:28,695 of the taper to mirror it.

00:18:30,710 Instead, I want this middle section to be the stroke width.

00:18:34,206 And that's actually another really easy x.

00:18:36,318 All I have to do is come in here and account for the fact

00:18:39,739 that there are half the number of groups.

00:18:42,291 So at the end of each linear interpolation,


00:18:45,085 I will just add a times two.

00:18:48,736 And I'll do that up here on this one as well.

00:18:52,114 And that will double the taper amount for each half

00:18:54,039 of the line, when the taper both is checked.

00:18:57,305 So, we'll reapply this to the stroke width,

00:18:59,896 delete the duplicates, and reduplicate.

00:19:05,240 Now the line is thicker at the middle.

00:19:07,450 If I uncheck, you see that now the stroke width

00:19:09,620 is just shifted to the center, rather than

00:19:12,512 shrinking down the front half of the line.

00:19:15,580 And again, the taper out slider is a ecting that half,

00:19:18,924 the taper in is a ecting this half.

00:19:21,136 And they t together nicely.

00:19:23,994 Now we need to turn on our master group,

00:19:26,050 and account for that.

00:19:27,636 So, let's go ahead and load up that stroke width.

00:19:31,149 And, I can copy over some of the variables that

00:19:33,139 we just de ned for the duplicate groups.

00:19:35,326 So, I'm going to need to know this taper both.

00:19:38,791 So I'll copy that.

00:19:40,651 And paste it here.

00:19:43,172 And, I just noticed that that was missing a semicolon.

00:19:45,953 So I'm just going to nish that o .

00:19:49,001 Like I aid, After E ects is generally pretty smart,

00:19:51,488 and knows when things should end and begin.

00:19:54,612 But, be consistent and just end lines with those semicolons.

00:19:59,989 Alright, what other variables do we need?


00:20:02,111 We'll need that taper in.

00:20:04,477 So I'll copy that,

00:20:07,469 paste, and I think that's it.

00:20:09,605 So after the reverse taper condition, I will drop down

00:20:12,409 this else, and type closing bracket,

00:20:17,100 else, if, parentheses,

00:20:20,344 taper both, equals one,

00:20:23,674 curly bracket, drop down an indent.

00:20:26,346 I can delete this curly bracket, because I have one

00:20:28,186 right here to close that statement.

00:20:30,272 And I don't need to add that second level to nd out

00:20:32,319 which half of the line it's on.

00:20:34,234 I already know which equation it should be using.

00:20:36,710 It's the same as the reverse taper.

00:20:39,590 So I'll copy and paste that expression.

00:20:43,386 And then multiply this by two at the end.

00:20:46,883 That should be all I have to do.

00:20:47,842 So, I'll go to the master stroke.

00:20:50,032 Now that master stroke ts in with the rest of the taper.

00:20:53,644 So if I adjust these sliders, everything is working

00:20:56,229 just the way it should.

00:20:58,054 Now here's an interesting problem with conditions.

00:21:01,059 If I check the reverse taper checkbox, taper in and out

00:21:05,327 no longer functions, even though it's still checked.

00:21:08,595 And the reason why that happens, is because a conditional

00:21:10,933 statement, as soon as it's met ...

00:21:13,951 The equation underneath it will be applied,


00:21:16,204 and then After E ects will stop.

00:21:18,395 It will completely ignore everything after

00:21:20,362 that condition is met.

00:21:22,323 So because reverse taper is rst in this list,

00:21:24,875 if that statement is true, it's going to apply

00:21:27,911 this equation, and it's going to stop right there.

00:21:31,187 Now I want this to function so that even if

00:21:33,112 the reverse taper is checked, the taper in and out

00:21:36,204 checkbox takes priority.

00:21:38,459 And we can actually do that pretty easily.

00:21:41,155 All I have to do is come up to this reverse taper condition,

00:21:44,587 and add another condition to it.

00:21:48,568 So you can actually have multiple conditions within

00:21:50,701 any conditional statement.

00:21:52,559 So I want to add after this reverse taper equals one,

00:21:56,224 two ampersands, which translates to and.

00:22:00,853 And then I'll type taper both equals zero.

00:22:05,352 Or, taper both is unchecked, then reverse the taper.

00:22:10,436 But, if either of these statements is not true ...

00:22:14,044 So the reverse taper is o , or taper both is on,

00:22:17,684 ignore this line of code, and go to the next statement.

00:22:20,961 So this should work exactly how I want it to.

00:22:24,120 So apply this to this master stroke,

00:22:26,987 and then I will come in to my duplicate strokes,

00:22:29,729 and I'll do the same thing.

00:22:31,984 If reverse taper equals one, and taper both

00:22:36,065 equals zero, reapply that.


00:22:42,280 Delete the duplicates ...

00:22:45,085 And reduplicate.

00:22:49,716 Alright, now both checkboxes are checked, but,

00:22:52,092 taper in and out is what's getting the priority.

00:22:55,237 If I uncheck taper in and out, my stroke still

00:22:57,921 tapers in reverse.

00:22:59,502 And I can uncheck reverse taper, and it goes back to normal.

00:23:03,236 If I check just taper in and out, that still works.

00:23:06,997 Alright, we're in business.

00:23:08,120 We've got two of these features

00:23:09,206 already completely functioning.

00:23:11,286 Now, let's say that you were using this taper on something

00:23:14,412 like a write on, where you had letters that you were

00:23:17,731 revealing through the tapered path.

00:23:20,317 You would probably want a trail to be left out

00:23:23,596 the same width as the smallest stroke.

00:23:26,432 Well, believe it or not, that is actually

00:23:27,973 really simple to do.

00:23:30,120 All I have to do is load up the trim paths'

00:23:32,503 start value of the duplicate groups.

00:23:35,532 And we're gonna need an extra checkbox,

00:23:37,389 so I'll duplicate this, and rename it trail.

00:23:41,832 And then we'll de ne that as a variable in this list.

00:23:45,020 VAR trail equals ...

00:23:48,772 I'll get that checkbox in the list.

00:23:50,650 And pick whip it.

00:23:54,795 And then we'll write a conditional statement.


00:23:57,031 So this one's pretty simple.

00:23:58,781 We'll start by typing if, trail, equals one ...

00:24:04,710 And, group, index,

00:24:09,445 equals, total groups.

00:24:13,859 Then, zero.

00:24:18,819 Else, the equation we already had.

00:24:24,570 So what this is saying is, if the trail is checked,

00:24:27,843 and the group index that this expression is applied on,

00:24:30,702 equals the total number of groups ...

00:24:33,223 Or in other words, if the group index is the last

00:24:36,708 group in the line,

00:24:38,908 make the start value equal to zero.

00:24:41,791 Not a variable, not another property.

00:24:44,343 Simply just a value of zero.

00:24:47,356 Otherwise, do exactly what you've already been doing.

00:24:50,436 And before I go any further, I need to make sure that

00:24:51,999 I actually de ne total groups as a variable up here.

00:24:55,903 Otherwise, there's nothing for it to reference.

00:24:57,951 So, I think the stroke width of the master stroke has that.

00:25:02,480 Yep, right there, total groups.

00:25:04,998 We'll copy and paste that in here.

00:25:07,235 And, this line of code is accounting for the master group.

00:25:11,315 I actually don't need that to happen in this instance.

00:25:15,395 I'm only concerned with the total number of groups

00:25:18,035 within this duplicate group's stack.

00:25:21,699 So I'm going to delete that plus one.

00:25:24,943 And that should be everything we need


00:25:26,351 for this expression to work.

00:25:28,091 So I will apply it to the start value.

00:25:31,687 Delete the duplicates, and reduplicate.

00:25:36,891 Now when I click the trail checkbox,

00:25:39,672 the last duplicate in this list has a start value of zero

00:25:44,547 on its trim paths.

00:25:46,019 Because we hard coded that value of zero,

00:25:48,303 for when that checkbox is checked.

00:25:50,518 And it still reacts to the taper out, because

00:25:52,498 this expression is written on the trim paths,

00:25:55,118 so it's not a ected by the other conditions

00:25:57,174 we have on the stroke width.

00:25:59,562 So that means that I can reverse the taper,

00:26:01,354 and it still works, and I can do the taper in and out,

00:26:04,522 and it still works.

00:26:06,050 So that was pretty painless.

00:26:07,745 Now I just want to talk about how you might animate

00:26:10,242 this line a little bit.

00:26:12,121 So, if you set a key frame on the end value, and

00:26:16,854 start it at zero, and then go forward a little bit in time,

00:26:20,218 and set it to 100 ...

00:26:22,494 Maybe I'll just easy ease these key frames,

00:26:25,883 and ran preview.

00:26:29,369 Alright, so very simple animation.

00:26:31,535 But right here at the front end,

00:26:33,486 you see that as soon as this value goes past zero,

00:26:37,649 the front end of the taper just pops on, it just appears.
00:26:41,190 And I'm not really happy with the way that that looks.

00:26:43,710 So I guess I would need to animate the stroke width along

00:26:47,074 with that, and possibly the segment length at the same time.

00:26:51,322 So let me go to right about here, where it's the rst frame

00:26:54,654 that you can see the entire line, and I'll set a key frame

00:26:57,702 for the stroke width, and the segment length.

00:27:00,705 And then I'll go back to the rst frame,

00:27:03,354 and change those values down to zero.

00:27:07,877 Then I'll probably want to easy ease these key frames

00:27:10,473 as well, and then we'll ran preview.

00:27:13,938 Alright, so that de nitely looks better.

00:27:15,718 It doesn't just appear out of nowhere, it kind of grows.

00:27:19,414 But because these key frames are eased, and these key frames

00:27:24,005 aren't in the exact same place, and they're also eased,

00:27:26,855 it's not as uid as I would like it to be.

00:27:29,923 And if I went into the graph editor, and modi ed these

00:27:32,883 at all, then where these two key frames are positioned

00:27:37,283 has to be completely changed.

00:27:39,031 So this is not a very easy way of dealing with this

00:27:41,639 very simple animation.

00:27:43,827 It'd be great if I didn't even have to think about

00:27:45,710 the stroke width or the segment length, and that scaling

00:27:48,734 automatically happened, based on how much of this path

00:27:52,122 was actually visible.

00:27:54,267 Well, that's exactly what we're going to do next.

00:27:56,983 So let me get rid of these key frames.

00:27:59,772 And we'll start with the segment length.


00:28:02,541 And the nice thing about the segment length is that

00:28:04,530 it's all being determined by the master trim paths.

00:28:07,985 Remember, all of these segments are the exact same length

00:28:10,922 as the master groups length.

00:28:13,681 So if I modify this one expression, it will re ect

00:28:17,345 in all of the other duplicates.

00:28:19,698 So I need another checkbox, and I'm going to name it

00:28:22,370 auto shrink in, and then I need to make a variable

00:28:26,210 for that checkbox.

00:28:27,911 So VAR, auto, shrink, in ...

00:28:31,511 Equals, then pick whip.

00:28:38,686 And I need to write a condition.

00:28:40,666 So, if, auto, shrink, in,

00:28:45,416 equals, one, then ...

00:28:50,453 And we'll write something there.

00:28:52,215 But rst, I'll nish o this conditional statement.

00:28:54,679 Else, this line of code we've already got.

00:29:01,750 Okay, so now let's go back up and write the actual equation.

00:29:04,867 So, if auto shrink in is checked, then we want to do

00:29:07,527 a linear interpolation.

00:29:09,220 So, linear ...

00:29:11,256 And we're going to look at the end value.

00:29:13,708 So, end, comma.

00:29:16,566 I want the range to be zero, to segment length, comma,

00:29:23,024 end, comma, this equation right here.

00:29:28,744 But I need to move that semicolon on the outside

00:29:30,891 of that parentheses.


00:29:33,256 Alright, so what is this expression saying?

00:29:35,289 Take the end slider's range from zero to segment length,

00:29:39,700 and I'm going to move that segment length up.

00:29:41,812 So whatever this segment length is set to,

00:29:45,015 and remap the values from the end value to the equation

00:29:48,753 we're already using.

00:29:50,448 So, let's apply this to the start value,

00:29:52,319 and see what happens.

00:29:54,659 If I turn auto shrink in on,

00:29:57,400 and then back this end slider up,

00:30:00,723 you see that as soon as this slider hits the segment

00:30:04,748 length of 50, the segment length starts to collapse.

00:30:09,743 And none of the path actually disappears,

00:30:11,943 it's all just collapsing down on each other.

00:30:14,670 If I change the blend mode of the duplicates to multiply,

00:30:17,188 this will be easier to see.

00:30:19,851 And maybe I'll knock down the number of duplicates to ve.

00:30:23,260 So as the end slider closes in from the segment length

00:30:25,935 down to zero, you see that the segment length

00:30:28,538 is actually collapsing.

00:30:30,972 That's exactly what I wanted.

00:30:32,894 So that's the rst part of the problem.

00:30:34,639 I'll change these back to normal.

00:30:36,499 The next part of the problem is that the stroke width

00:30:38,588 also needs to collapse down.

00:30:40,735 But the duplicate stroke widths are not based on the master

00:30:43,439 stroke width, so there's gonna be a few more steps.


00:30:46,981 Let's start with the master stroke though.

00:30:50,624 I'll extend this out so I can see the whole line.

00:30:53,361 And then I'll go into the master stroke.

00:30:56,182 I'll load that up, and this is where I'm going to point out

00:30:59,076 that these conditional expressions can get very complex,

00:31:03,135 the more features you add.

00:31:05,039 Because remember, if one set of conditions is met,

00:31:08,360 then all of the other conditions are ignored.

00:31:11,649 So I'm going to write this condition as if none

00:31:14,508 of the other checkboxes are checked.

00:31:16,982 A little later, we'll come back to guring out

00:31:18,953 how to get it to work with the other checkboxes.

00:31:21,822 But for now, let's just say these checkboxes are unchecked.

00:31:25,001 So, I'm going to add another conditional expression

00:31:27,445 right before else.

00:31:29,839 So I'll add the closing bracket,

00:31:32,347 else, if, parentheses.

00:31:36,397 And I need to get that variable that I de ned

00:31:38,178 for the auto shrink in,

00:31:40,079 from the master start.

00:31:41,777 So, let's nd that variable.

00:31:44,248 There we go, auto shrink in.

00:31:46,341 And we'll ...

00:31:48,277 Copy that, and paste it here.

00:31:52,060 And then I will type auto, shrink, in, equals one.

00:31:58,485 Then I'll get rid of this extra curly bracket.

00:32:02,236 So if auto shrink in is one, I want


00:32:04,657 another linear interpolation.

00:32:06,569 So linear, end, comma.

00:32:09,958 And again I don't have the end value de ned

00:32:12,716 in my variables list.

00:32:14,382 So let me grab that.

00:32:17,008 Copy and paste it.

00:32:19,879 So, linear, and, zero,

00:32:22,908 to segment length,

00:32:24,800 comma, zero, comma, stroke, width.

00:32:29,916 But I'll end that with a semicolon.

00:32:32,322 So for the master stroke, it's not that complicated at all.

00:32:35,427 I'll apply that ...

00:32:37,627 Oh, and it looks like I forgot to add

00:32:39,387 the segment length variable.

00:32:41,244 So let me just copy and paste that real quick.

00:32:46,427 You see that Expressionist gives me the same

00:32:48,296 error message that After E ects does.

00:32:50,540 But, it conveniently places it directly below the line

00:32:54,512 that the error is coming from.

00:32:56,943 So that's another really great time saver.

00:32:59,202 Alright, so I put my segment length variable in there.

00:33:01,487 I should be able to re-update that expression.

00:33:04,286 And there we go, the error goes away.

00:33:07,377 Now, if this end value goes below 50, you can see that

00:33:10,941 that master stroke width is getting smaller,

00:33:13,888 and shrinking down to zero.

00:33:15,473 Great.
00:33:16,529 So let's make that same functionality happen

00:33:18,465 to the rest of the stroke widths.

00:33:20,674 I'll load up the stroke width for the rst duplicate.

00:33:26,229 And again, assuming all of these checkboxes are unchecked,

00:33:29,498 I'll drop down and type another condition.

00:33:33,194 Else, if ...

00:33:35,658 Auto shrink out,

00:33:38,430 equals one.

00:33:40,586 Then, and get rid of that curly bracket.

00:33:45,632 And again, we need those extra variables,

00:33:47,448 so we need the end ...

00:33:52,155 I'll put that at the top.

00:33:53,793 We need the auto shrink in.

00:34:00,780 And we need the segment length.

00:34:06,356 So we've got a decent list of variables,

00:34:08,656 but that's totally ne.

00:34:09,896 It's making everything a lot easier to code.

00:34:14,156 Alright, so let's go back to our condition.

00:34:16,452 If auto shrink out is one, then we want to linear

00:34:20,172 the end value from zero

00:34:24,019 to seg length to zero

00:34:28,416 to this linear interpolation down here.

00:34:32,477 So, we are actually putting a linear interpolation

00:34:35,868 within a linear interpolation.

00:34:38,317 Now that might seem a little bit crazy.

00:34:40,288 And, if you do stu that's super super complex,

00:34:43,541 with lots of math happening within those linear


00:34:46,545 interpolations, it can really slow down your render.

00:34:50,009 But in this case, it's really not that complex,

00:34:53,001 and it doesn't add much render time at all.

00:34:55,753 So, I want to make sure that I end this line

00:34:58,116 with a semicolon.

00:35:00,448 And I will apply that to the stroke width.

00:35:06,176 Oh, and I got another error.

00:35:08,080 I accidentally typed auto shrink out,

00:35:10,412 that will come in a little bit.

00:35:13,164 I need to change that back to auto shrink in,

00:35:15,276 reapply it, now we're good.

00:35:17,352 Alright, let's delete the duplicates, and reduplicate,

00:35:22,700 and see if it worked.

00:35:25,173 As I bring this down, not only does the segment length

00:35:28,044 get smaller, but the stroke width also gets smaller.

00:35:31,482 So that is working exactly the way it needs to.

00:35:34,259 And if I adjust the segment length,

00:35:37,044 it doesn't kick in until the end value reaches

00:35:41,268 the segment length's value.

00:35:43,028 Which also just happens to be the exact amount

00:35:46,536 of how much of the line is visible.

00:35:50,077 So, as soon as that tail end of the line hits the front

00:35:53,280 of the path, it starts to scale down.

00:35:55,938 So that's working perfectly.

00:35:58,787 But, what if we want it to happen

00:36:00,924 on the opposite end as well?

00:36:03,673 Well, we can be a little bit clever, and get that


00:36:05,808 to work fairly simply.

00:36:08,052 Let's add another checkbox, called auto shrink out,

00:36:13,056 and go back to our master trim paths.

00:36:15,500 We'll start there again.

00:36:17,619 Load that up.

00:36:19,812 And we need to de ne that new variable,

00:36:21,516 so I'll just duplicate this auto shrink in,

00:36:24,168 and rename it auto shrink out.

00:36:26,993 And, auto shrink out, to reference the right checkbox.

00:36:32,358 And rst I'll start by assuming that auto shrink in

00:36:34,660 is not checked.

00:36:36,376 And I will drop down, add another condition,

00:36:39,313 else, if, auto, shrink, out,

00:36:44,340 equals, one ...

00:36:48,048 Then, linear, end, comma.

00:36:54,152 And this is where it's gonna get a little bit di erent.

00:36:56,218 I need a di erent range if this is going to work properly.

00:37:00,240 The way that I want it to behave is ...

00:37:02,031 Say this segment length is 25.

00:37:04,915 So I want the auto shrink out to kick in as soon as

00:37:07,840 it's 25% away from 100.

00:37:12,692 So, 75.

00:37:14,704 So the way that we'll do this, is by saying 100 minus

00:37:18,676 the segment length, rather than just the segment length.

00:37:24,120 Comma, 100, because I want it to go from that point,

00:37:28,960 to the end, which is 100, not zero.

00:37:34,516 And I want to remap those numbers from this equation


00:37:37,538 right here, which is determining the segment length,

00:37:40,347 and make sure that I delete this duplicate curly bracket,

00:37:43,603 or else the expression will break.

00:37:46,824 Comma, end, and end it with a semicolon.

00:37:53,107 So once the slider reaches 100, the start value should

00:37:57,199 be equal to the end value.

00:38:00,289 Alright, let's apply that to the master trim paths' start,

00:38:03,583 and see if it worked.

00:38:05,405 Again, this is assuming that auto shrink in is o ,

00:38:08,168 so I will uncheck that.

00:38:10,049 And let's test it out.

00:38:12,225 Yep, it's working, awesome.

00:38:14,203 So how do we get it to work with auto shrink in?

00:38:17,634 Well, we need to put another condition within

00:38:19,606 this condition, and it's gonna get

00:38:21,313 a little bit more complex.

00:38:23,225 But it's still pretty easy to understand.

00:38:25,064 So inside of this auto shrink in statement,

00:38:28,452 we need to rst check for another condition.

00:38:31,839 So I will indent, and type if, auto,

00:38:35,414 shrink, out, is, on, and,

00:38:41,560 the end slider is greater than

00:38:44,531 the segment length slider, then ...

00:38:52,132 Give give me this auto shrink out equation.

00:38:57,511 Else, give me the auto shrink in equation.

00:39:07,520 So adding the two ampersands next to each other

00:39:10,125 within this condition is allowing me to have two conditions


00:39:13,912 that need to be met in order for this to be carried out.

00:39:17,513 And the way that this is used is pretty clever,

00:39:19,086 because what it's saying is what if auto shrink is checked,

00:39:21,717 and the end slider is greater than the segment length,

00:39:26,105 then apply the auto shrink out equation.

00:39:30,317 If the end slider is less than the segment length,

00:39:33,353 then give me just my auto shrink in expression.

00:39:37,445 So that's how we can apply both the auto shrink out

00:39:40,229 and auto shrink in expressions at the same time.

00:39:44,189 So let's apply this to the master start.

00:39:48,533 And see if it worked.

00:39:50,171 I'll check both boxes, and move the end slider back,

00:39:54,573 and it shrinks down, perfect.

00:39:57,137 And I'll go with this other direction,

00:39:58,596 and it also shrinks down.

00:40:00,489 So yes, that is functioning perfectly.

00:40:03,384 And let's just double check the controls to make sure

00:40:05,981 that the auto shrink in still works.

00:40:07,597 Yep, and the auto shrink out still works on the trim paths

00:40:10,918 on its own.

00:40:12,150 Awesome, so we can move on from the master trim paths.

00:40:15,681 Let's go to the master stroke width.

00:40:18,949 Load that up.

00:40:21,049 We need to start by de ning the variable

00:40:22,865 for the auto shrink out.

00:40:24,481 So I'll just duplicate this variable, and adjust the naming.

00:40:29,222 So auto shrink out.


00:40:31,246 And the name of the checkbox is auto shrink out.

00:40:35,097 Then let's start with just the single auto shrink out

00:40:38,550 checkbox checked, drop this down a line,

00:40:41,433 and add a else, if,

00:40:46,225 auto, shrink, out,

00:40:49,083 equals one, then ...

00:40:53,605 Get rid of that extra curly bracket.

00:40:56,001 Linear, end, comma, 100 minus seg length,

00:41:03,569 comma, 100, comma,

00:41:07,969 stroke, width, comma, zero.

00:41:12,711 And then semicolon.

00:41:14,801 Let's apply that to the stroke width,

00:41:16,737 and then see if it works.

00:41:18,880 The auto shrink out scales down, yes.

00:41:22,258 The front master group, you can see, is scaling down.

00:41:26,098 Now let's account for the auto shrink in also being checked,

00:41:29,289 because right now that cancels it out.

00:41:32,829 So, we'll go up to auto shrink in,

00:41:37,528 and drop down indent, and make a new condition.

00:41:41,885 If, auto shrink out equals one,

00:41:46,737 and, end is greater than segment length,

00:41:52,325 then ...

00:41:56,745 We want this equation right here that we just wrote.

00:42:02,741 Else, this equation right here.

00:42:11,599 Alright let's apply that to the master stroke.

00:42:15,315 And double check that it's working.

00:42:18,085 Shrink's out that way,


00:42:20,133 and it shrinks out that way.

00:42:22,698 Great, that is working.

00:42:24,854 Let's move on to the duplicate groups' stroke width.

00:42:31,340 And again, I need that auto shrink out variable,

00:42:33,291 so I will just copy it from the one we were just using.

00:42:37,468 And paste it right here.

00:42:40,141 Then I'll start down here again,

00:42:42,233 and make the condition else,

00:42:44,358 if, auto shrink out

00:42:47,506 equals one, then ...

00:42:50,913 Get rid of that extra curly bracket.

00:42:53,466 Linear, end, comma,

00:42:55,727 100 minus segment length,

00:42:59,348 comma, 100, comma,

00:43:05,672 this equation right here,

00:43:09,480 comma, zero, semicolon.

00:43:14,944 Then I'll copy that entire line of code,

00:43:17,576 and we'll come up into the auto shrink in condition.

00:43:21,491 Drop down an indent, and say if, auto shrink out

00:43:28,156 equals one, and the end value

00:43:31,676 is greater than the segment length, then ...

00:43:36,296 And I will paste the expression I just copied

00:43:39,136 from auto shrink out.

00:43:41,104 Else ...

00:43:45,781 This equation right here.

00:43:51,909 We should be able to apply that to the stroke width,

00:43:54,734 and delete and reduplicate that group.


00:43:58,266 And check to see if it worked.

00:44:00,301 So, let's move the end value.

00:44:02,589 And sure enough, it is scaling out,

00:44:04,458 and the segment lengths are decreasing

00:44:06,957 on the out and the in, perfect.

00:44:12,369 So let's just double check to make sure these work

00:44:13,916 on their own as well.

00:44:16,042 Auto shrink out o , so just the auto shrink in.

00:44:19,163 Yep, that works.

00:44:20,706 And the auto shrink out only, auto shrink in is disabled,

00:44:25,062 auto shrink out is working.

00:44:26,657 Perfect, these features are working great.

00:44:29,749 Now, one little problem that I need to bring up

00:44:32,829 is that if I increase the segment length,

00:44:35,733 past 50%, so say 60 ...

00:44:39,944 And both auto shrink in and auto shrink out

00:44:42,541 are enabled, then when I get to that threshold

00:44:46,777 of 60 on the end value, you see that, boom,

00:44:51,064 it pops right there.

00:44:53,069 Now, the reason this is happening is because both

00:44:55,576 the auto shrink in and auto shrink out values

00:44:58,985 are based on where that segment length is.

00:45:02,582 And because the segment length is greater than half

00:45:05,607 of the entire range, the taper out equation

00:45:09,531 takes place before we reach that threshold.

00:45:13,462 And so it snaps as soon as that condition is met,

00:45:16,894 and that equation kicks in.


00:45:19,962 So what I'd like to do is to give priority to the auto

00:45:22,980 shrink in, so that if both are checked, and the segment

00:45:25,695 length is great than 50, it ignores the auto shrink out.

00:45:30,273 That's actually really simple to do.

00:45:32,772 So let's just jump back to the master trim path start value.

00:45:36,885 And we're going to go to the auto shrink out within

00:45:39,480 the auto shrink in condition.

00:45:41,869 And we're going to add one last condition,

00:45:44,606 which is, and, seg length,

00:45:48,866 is less than or equal to, 50.

00:45:52,683 So this is how you can say less than or equal,

00:45:54,544 you just use the less than sign,

00:45:56,491 followed up with an equal sign.

00:45:59,329 So I'm gonna copy that line of code,

00:46:00,705 'cause we're going to reuse that.

00:46:02,474 But I'll apply that to the master trim path start.

00:46:05,973 And already, we see that things are happening.

00:46:08,196 Then I'll go to the master stroke,

00:46:10,748 load that up.

00:46:12,353 And again, nd the auto shrink out within the

00:46:14,807 auto shrink in, and paste this code right here.

00:46:19,194 Looks like I forgot to copy my ampersands, so let me

00:46:21,351 add those back in.

00:46:23,761 And then copy that line of code again.

00:46:26,750 So, auto shrink out is one, and end is greater than segment

00:46:29,980 length, and the segment length is less than or equal to 50.

00:46:33,558 Great, I'll apply that to the stroke width.


00:46:36,988 That updated.

00:46:40,346 Now let's go to the stroke for the duplicate groups.

00:46:44,326 Find that same condition, so auto shrink out ...

00:46:48,078 After the segment length I will paste and apply that.

00:46:53,854 Then I'll delete the duplicates, and reduplicate.

00:46:57,946 And now, the segment length is greater than 50.

00:47:01,046 So, the auto shrink in works,

00:47:03,622 but the auto shrink out is disabled.

00:47:06,118 Great, if I drop this down below 50,

00:47:08,702 then again, that kicks back in, and it works.

00:47:12,686 So, let's take a look at how this could be animated now.

00:47:16,961 I'll set the key frame on the end value,

00:47:19,638 start it at zero.

00:47:21,463 Go forward maybe a second or so.

00:47:25,226 And, we'll set that to 100.

00:47:28,577 Then I'll ran preview this.

00:47:33,818 And with just two key frames, I'm able to animate this taper

00:47:37,101 in and out, and it will automatically scale up, and scale

00:47:40,530 down, based on how much of that line is visible.

00:47:43,915 So I could go in here now, and adjust my value curves,

00:47:47,822 and everything else happens for me automatically.

00:47:51,057 So that is a huge time saver when it comes to

00:47:53,498 animating lines like this.

00:47:56,150 Now, I mentioned earlier that adding all these extra

00:47:59,041 checkboxes is making things a lot more complex,

00:48:02,815 and I coded the last couple of features assuming that

00:48:05,828 other checkboxes weren't on.


00:48:08,544 The reason why is because if I enable, say, the reverse

00:48:12,594 taper, that is now going to break the expression

00:48:18,831 that controls the stroke width auto shrink in and out.

00:48:23,063 Because, remember, if a condition is met,

00:48:26,835 After E ects applies the expression,

00:48:29,487 and then ignores everything after it.

00:48:32,159 Since reverse taper is in the top of this list,

00:48:35,063 that condition is met with that checkbox being checked,

00:48:38,419 and everything else is disregarded.

00:48:40,762 So every time you add another checkbox control,

00:48:43,743 it adds another layer of conditions that you have to

00:48:46,559 take into account.

00:48:48,394 And it can get really complex, really quickly.

00:48:51,683 On top of that, some of these combinations of checkboxes

00:48:54,771 require completely di erent equations.

00:48:57,518 For example, if you had the trail enabled, and reverse taper

00:49:02,327 was o , and you animated this out, and had auto shrink out

00:49:06,131 enabled, it's going to shrink that trail out to zero.

00:49:10,488 And that's probably not what you would want.

00:49:16,639 Instead of automatically shrinking everything down to zero,

00:49:17,472 it would be way more functional if the taper shrunk down

00:49:19,815 to be the stroke width of the trail, rather than zero.

00:49:25,128 And the same way if it was reversed.

00:49:27,540 Then you would want the taper to scale up into that

00:49:30,564 thickest stroke width.

00:49:32,752 So it's de nitely a lot more complicated,

00:49:34,964 and you have to take a lot more things into account.
00:49:37,800 I'm going to spare walking you through every single line

00:49:40,772 of code, and instead jump to the nal rig, and just

00:49:44,259 show you how it's working.

00:49:46,756 Alright, so here is my nal tapered stroke rig,

00:49:49,660 with all the controls working exactly the way

00:49:51,790 that they're supposed to.

00:49:53,312 And all the di erent combinations of these checkboxes

00:49:55,780 are also going to behave properly.

00:49:57,704 So let's take a look at that combination of the trail

00:49:59,872 being checked, and the auto shrink out being checked.

00:50:03,093 Now, you already see that this is single width line,

00:50:06,416 instead of it scaling down to zero.

00:50:08,044 So if I back this up from the end, you see that

00:50:10,634 that taper now scales down to the smallest stroke width,

00:50:14,782 or the trail width, instead of down to zero.

00:50:17,530 That makes things likes write ons with text so much easier,

00:50:21,182 because you end up with a single width line by the time

00:50:24,241 the animation is nished.

00:50:25,880 And this works with every combination of checkbox.

00:50:28,510 If I reverse the taper, instead of scaling down,

00:50:32,754 the taper scales up, to be the width of the trail.

00:50:34,997 Same thing with the taper in and out.

00:50:36,208 I'll back that up, and you see that both halves

00:50:38,596 are scaling down to be the trail width.

00:50:41,478 So let's uncheck all these boxes, and take a look

00:50:43,965 at what happened to the code.

00:50:46,007 I'll go into the contents, and the duplicate groups,


00:50:48,154 and I'll just load up the stroke width

00:50:49,384 of the rst duplicate.

00:50:51,880 Now, there are so many more lines of code here.

00:50:55,339 So much so that I can't even t it all on one screen,

00:50:57,532 I have to scroll down.

00:50:58,706 I think we went from around 35 lines of code down to 108.

00:51:03,610 And the reason why there are so many more lines of code

00:51:06,319 is because all of these di erent combinations of checkboxes

00:51:09,641 forced me to account for so many more conditions

00:51:12,580 within my conditional statements.

00:51:14,956 So for example, that trail combined with auto shrink out.

00:51:18,730 Well, I'll scroll down to the bottom where we have auto

00:51:20,930 shrink out, which is right here, there's our condition.

00:51:23,658 And you'll see that the rst thing I do is check to see

00:51:26,749 if the trail is also enabled.

00:51:29,378 If the trail is enabled, then we get a linear expression.

00:51:33,328 The result of all of the conditions, and you can see

00:51:35,659 this all the way through my entire expression,

00:51:38,456 is a linear interpolation.

00:51:40,037 That hasn't changed.

00:51:41,360 The only thing that has changed is how that range

00:51:43,923 of values is being interpolated.

00:51:46,387 So, if the auto shrink out is on, and trail is on,

00:51:50,334 then we want to interpolate to the trail width,

00:51:53,786 rather than zero.

00:51:56,408 If trail is not checked, then we do want to interpolate

00:51:59,057 down to zero.


00:52:00,176 Now the trail width, if we go up to the variable list,

00:52:03,339 you see that I de ned this as a variable.

00:52:05,264 This is just the stroke width of the rst

00:52:07,772 duplicate taper group.

00:52:09,620 And the reason why I can de ne it as that stroke width

00:52:13,019 is because that group is never going to be deleted.

00:52:16,351 This is the group that you duplicate to increase

00:52:17,739 the resolution, basically, of your taper.

00:52:20,174 So that's always going to be there, which made it okay

00:52:22,305 to turn that into a variable.

00:52:24,537 But once I had that as a variable, I can use it as part

00:52:27,531 of my interpolation, so that whatever size it is,

00:52:32,029 no matter which one of these checkboxes is turned on,

00:52:34,515 it will always interpolate down to that size, or up

00:52:38,046 to that size, instead of to zero.

00:52:40,764 And like I said, you can see this same format repeated

00:52:43,184 through every single one of my conditions.

00:52:45,868 The expression itself if pretty simple, it's just checking

00:52:48,059 to see if a checkbox is checked, and then in this instance,

00:52:51,720 it's seeing if auto shrink in is checked, and then

00:52:54,563 the third level is to see if auto shrink out is checked.

00:52:56,907 And then check to see if trail is checked.

00:52:59,182 And if all of those things are checked, and all

00:53:00,975 of the conditions are met, then apply this

00:53:03,243 linear interpolation expression.

00:53:05,707 Otherwise, if this condition right here

00:53:07,247 isn't met, apply this.


00:53:09,810 If this condition isn't met, then skip everything between

00:53:12,295 this curly bracket and this curly bracket, and go on

00:53:15,190 to the next thing, which would be right here.

00:53:17,575 If this condition isn't met, ignore everything between

00:53:20,490 this curly bracket, and this curly bracket, and check

00:53:23,130 for the next condition.

00:53:24,991 So this is a great example of why having this structure

00:53:28,521 of putting line breaks after curly brackets and indenting

00:53:31,898 for every level of condition is so important.

00:53:35,460 Because it allows you to follow this hierarchy

00:53:37,900 visually through your code, to make it a lot easier

00:53:41,159 to follow and understand.

00:53:43,150 It makes absolutely no di erence to After E ects

00:53:44,954 if you drop down a line and indent.

00:53:47,053 I could have written this entire 108 lines of code

00:53:50,170 on a single line, and After E ects still would have

00:53:52,620 interpreted it exactly the same way.

00:53:54,162 But that would make it impossible for me to wrap my head

00:53:57,362 around what exactly is going on in this code.

00:53:59,893 Now, all of that code is just for the stroke width

00:54:02,357 of the duplicate groups, but we had to take a lot

00:54:04,469 of these conditions into account for the master

00:54:06,393 group as well.

00:54:07,556 So if I open that up, and take a look at the master stroke

00:54:10,372 width, you see that I had to build a bunch of conditions

00:54:12,679 into this as well, in order to get it to behave properly

00:54:15,670 for all of these combinations of checkboxes.


00:54:18,452 It wasn't as complicated for the trim paths,

00:54:21,048 on the master group or on the duplicate groups.

00:54:23,995 But there were some things I needed to take into account.

00:54:26,712 So feel free to download this project, and dig through

00:54:28,362 the code to see how everything is functioning,

00:54:30,212 if you're curious.

00:54:31,486 But the basic format is always the same.

00:54:33,524 You always start with a condition, and sometimes there's

00:54:36,548 multiple levels of conditions, and if all those conditions

00:54:39,470 are met, apply this expression.

00:54:41,651 Otherwise, apply this expression.

00:54:43,720 And that structure is the foundation for every single one

00:54:46,008 of the features in this tapered stroke rig.

00:54:49,099 One last thing I want to point out is that you'll see

00:54:50,978 some gray text up here, next to some of the variables

00:54:53,988 in other lines of code, within the rig.

00:54:56,244 And these two slashes means that it's a comment,

00:54:58,562 and After E ects will not read this as code.

00:55:01,712 So I just gave a few explanations of some

00:55:03,824 of the choices I made.

00:55:05,252 For example, this num properties plus one.

00:55:07,715 I added the comment that explains that we had to account

00:55:10,223 for that extra group, the master group, outside of

00:55:12,776 the duplicate groups folder.

00:55:14,612 This style of commenting will make everything after

00:55:16,738 these two slashes on that line a comment.

00:55:19,913 So, if I were to put this before the variable,


00:55:23,062 that will comment out the variable, and it will

00:55:26,714 no longer work.

00:55:29,750 So if you use one line comments, make sure they go after

00:55:33,292 a line of code, or in between lines of code.

00:55:36,109 Now you can make a comment not extend an entire line,

00:55:38,575 if I had changed this from a slash slash to slash star,

00:55:42,511 and then ended it with a star slash.

00:55:46,161 Then everything between that becomes a comment.

00:55:48,625 And I can even drop this down a line, and add more text,

00:55:52,183 on as many lines as I need to.

00:55:53,831 So that's how you can add notes to your expressions,

00:55:56,205 for your own bene t, or for other people's bene t,

00:55:58,615 if you pass it on to somebody else.

00:56:01,995 Oh my gosh.

00:56:03,499 Congratulations on making it through all of that lesson.

00:56:07,634 I'll give you a virtual high ve.

00:56:09,175 You should probably go outside, take a walk around

00:56:11,829 the block, because that was probably way too much code

00:56:14,328 to be taking in at one time.

00:56:16,310 Not only have you created a completely customizable,

00:56:19,538 reusable, and streamlined tapered stroke rig, you learned

00:56:23,418 so much about using really powerful expressions to come up

00:56:26,773 with solutions to pretty complex problems.

00:56:29,985 You can now use expressions as a problem solving tool,

00:56:34,126 instead of just applying the wiggle to any property,

00:56:36,576 to get some randomness out of it.

00:56:38,635 I can't say enough great things about Expressionist,


00:56:40,923 so again, if you think you're going to be getting into

00:56:42,756 this world of expressions, I highly recommend

00:56:44,948 you go check it out.

00:56:46,376 Thanks so much for watching, and I'll see you next time.

00:56:55,382 (upbeat instrumental music)

Similar lessons

After E ects Create a Carousel Rig


Expressions 101 in After E ects

Вам также может понравиться