19 Useful Expressions in After Effects - Part 2 of 2

Video Statistics and Information

Video
Captions Word Cloud
Reddit Comments

Your last video taught me several expression I constantly use now, so thanks for showing some more!

👍︎︎ 7 👤︎︎ u/josh8644 📅︎︎ Jul 05 2017 🗫︎ replies

So useful, I usually pick up that much useful AE stuff in months rather than minutes.

👍︎︎ 4 👤︎︎ u/Jambamatt 📅︎︎ Jul 05 2017 🗫︎ replies

Fantastic post, thanks!

👍︎︎ 2 👤︎︎ u/eat_thecake_annamae 📅︎︎ Jul 05 2017 🗫︎ replies

I've just put this in the watch later section.

My only issue with expressions is i forget them in about a quarter of the time it took me to learn them. haha

👍︎︎ 2 👤︎︎ u/SiHaze 📅︎︎ Jul 05 2017 🗫︎ replies

I would like to see... rigging a face, for opening mouth, eyes.

👍︎︎ 2 👤︎︎ u/osterling 📅︎︎ Jul 05 2017 🗫︎ replies
Captions
hello and welcome to Yuka Mediacom my name is Sergey prac Nevsky and today I'm going to show you 19 more useful expressions in After Effects that's right 19 more which means this is the part two and in the first part I went over 16 useful expressions in After Effects so definitely check that one out first before you watch this one before we get to the tutorial I want to show you something I'm very passionate about and that is this modular lower third kit that is available at UK Mediacom slash shop you can purchase it today and the cool thing about this that it's fully modular automated responsive whatever you want to call it I mean you can change the name of the text let's say Kerry Patrick and things adjust automatically you know the width of it the animation stays the same the timing doesn't change another cool thing is if let's say you know you can scale a text and things adjust or you can you know if this text becomes smaller than or shorter than the other two the edge knows that it automatically stays with the longest text and the same thing is true with you nor any other ones as well so if this one goes up and it becomes bigger than the other you know you pushes the edge with it so that's really cool and another I mean I'm scratching the surface here but by the way I created the video at Yuka Mediacom slash shop to where you can you know it goes over every feature on here but I'm just highlighting few that I'm excited about for example you can turn off this logo at any time you know you place the logo in this comp there are only two comps so this is it and you know at any moment you can take it off and things you know the animation doesn't change you can turn it back on you can also you know turn off the text the first title and the second or vice versa and you can see that things adjust animation stays the same you couldn't even turn off the logo and just end up with the name I mean there are more things you can do in here you can change the color you can change you know the sizing the the gaps and all that stuff and it is in here you know you can even do it around and corners skew and again whatever you change in here unless you messing with the animation settings you know whatever you change in here doesn't change the animation one bit so it's super cool but another thing I'm excited about is that this file itself is very tiny like if you download it you'll see it's not even one Meg and the after you unzip the zip file it's still very tiny so it's like what three mags or so so yeah this thing is super tiny you can literally email that to yourself and another thing applicated some presets for it you can go through like the just basic designs that I have that you can build up on you can also go through yeah some simple ones and stuff like that I mean you can see what I've had what I have here and the cool thing about it is you can build up on it you can create you open up different settings and play with it it's super awesome and also created these color themes that you can just shuffle through on-the-fly and pick your own color combination that you like and go from there so yeah it's definitely useful another cool thing about this that I'm very excited about by the way all this stuff that I'm talking about you can check it out in the video all the descriptions I'm talking about you can check it out if you commute at that constant shot but the thing about all this is that now you know you can control everything that I'm controlling here you can also adjust in premiere so once you set up your fonts and stuff you can export it into premiere and inside premiere you can adjust the text and everything and things shift and so you don't even have to leave premiere so it's super awesome so again these features are you know in the video that you can check out but in the meantime let's dive right into our nineteen useful expressions in After Effects number one is modulus and this one is a small one but I find it very useful especially for things like clocks countdowns and stuff like that so let me show you what it can do I have the simple composition here nothing complicated just a JPEG background here but I'm going to double click on this text to bring text into my composition I'm just going to type as usual Yuuka mediacom but you don't have to type anything because we're going to go down to text and source text right here I'm going to select it and hit s twice on my keyboard to solo it and next I'm going to hold alt on the keyboard and left-click on the stopwatch to activate the expression and so now I can type my expression in this window here first I'm going to just time just to see what that does so we can see time but let's be speed this number up a bit so I'm going to do times 20 and so now we can see that it's jumping pretty pretty good and the only other problem we have we have all this other I want to get rid of it's too many numbers so how do I round this up to like 27 at this point and if you've seen my previous tutorial the useful expressions in After Effects part 1 you would know how to use this function called math round and open parenthesis and closed parenthesis and basically it'll run whatever's between these two parenthesis and so if you let go you can see it's going to run it up to 27 and so that's exactly what I need so that's good but now let me show you what modulus is you know how you can definitely use it so for example right now it's climbing up to 60 and it keeps going but what if let's say I wanted to you know once it hits 60 instead of going to 61 I want to go back to 0 so how do I make that happen so this is what modulus comes in handy so I'm going to add to this expression I'm going to do a percentage key on my keyboard and then type 60 and so what it's going to do now once it hits 60 after that it's going to go back to the to the beginning and so that's what modulus does so let's see this played out so you can see we're in the 30s 40s 50s and then back to zero number 2 is active and enabled and so for this example I have a quick setup in here and let me briefly tell you what I have so just to have a simple note that plays the role of a parent of text 1 and 2 and so basically I linked them up parented both of them to this control and now I can easily grab the null and both of the text moving with it and for the last name I used a little expression and so basically for the X you know I separated my dimension and then for the x position I typed like a simple expression so I just gave it a random name it can be anything and then I defined it I gave it some kind of value so I said this thing you'll be this layer so every time I say first name I'm actually referring to Saylor so now I'm saying first name which is that layer and then I'm adding or I'm calling the width of it so if you don't know how to use a source rect at time be sure to check out part one but basically I'm grabbing the width of that layer and I'm adding it to this last name so this last name started out at the zero zero here and then I added the width of the first name so then it pushed it to here and then I said plus 40 and then pushed you know it created this gap here but now what I want to do when I unchecked the visibility over here I want for the last name to shift back to the zero zero and then when I enable it I wanted to go back to where it was so how do I do that and to do that I'll use an if statement and by the way if you don't know how to do if statement I did go over that in my first part of this tutorial so definitely check it out but let me show you what you do I'm going to type an if statement if and then I'm going to say if what first name which is that layer whatever I define in here is enabled and you can do you know either active or enabled type any of them I'm do active if if active is checked and that's what it means to equal signs mean is checked and then do this but first you have to do open up the bracket so if that's checked runs this and then if it's not checked as you close back it and open bracket in between here I'm going to type else so if it's not checked do this which is 0 and then let's close the bracket so what I'm asking here I'm going to say hey if this thing is checked which it is now I do do this what it's doing now but if it's not checked 0 out of the exposition of this Patrick layer so let's see if it works I'm going to uncheck this and as you can see it shifts Patrick back to the origin if I check it it does the opposite number three is parent and so I have just a text and then I have text one and two so if I parent this you commedia text to text one it snaps right to the right of this text but if I parent it to the text too it snaps right to the end of text two and in fact I can you know add anything I want to it it will honor that so how do I set this up using expressions so let me show you first thing I'm going to do hold alt on my keyboard and then click on the stopwatch here to get rid of my expressions so right now you can see that this text doesn't have any anything no expressions none of that so let's start fresh so the first thing I'm going to do I'm going to pick whip or in other words parent this you commedia text to text one because we'll be working with that first and I'm going to all click on the Y position here and type 0 basically it's like a constraint so I don't want any other number then you know the 0 so that's that's what it's going to do and for the x position I'm going to hold alt click on the stopwatch there and then what I'm going to do I'm going to type in fact I'm going to pick whip to the parented layer text 1 ok and then I'm going to add to it so I'm going to say alright I'm going to grab the source rect at time in other words I'm grabbing width of the text 1 and so you felt like go right now you'll see that it'll snap you know it'll add this width of this text 1 to the position of equal media so you can see it shifted nicely so if I type you know anything in here it's working so but let's add some gap in here so I'm going to say plus and then let's do like 30 so that's working fine but now if I select this you commedia text and if I parented to text 2 it'll snap it you know to text 2 on y-axis because I have a 0 down and then but the thing is it's still grabbing the the width of text 1 so it's not really working for the text too so how do we fix that so this is what parent comes in handy so instead of me referring to specific layer instead of doing that I'm just going to type in parent so I'm just saying grab the width of the parented layer so now it doesn't really matter you know you can parent it to any layer and it will automatically adjust and snap it to where it needs to be number four is try-catch statement and you know this was not a very flashy one but I find myself using it all the time so let me show you what it does and for this I'm going to continue with the previous example and so what happens to this Yuka media tax doesn't have a parent in other words if it's not parented to anything what happens so if you set that to none you can see we get this error so how do we fix it and so here's how we do it you know obviously something is messed up with this expression because it would have a parent so it freaked out and give us gave us this air so to fix it we're going to use this try catch statement but it's very similar to if-else statement and I'll show you what I mean so I'm going to type let's say try and an Open bracket let's say try this statement and if something happens to it if it gives you an error so this one we're going to put them here we're going to say catch and then parentheses we're going to say error so if something happens to catch it and play or you know do this it will tell it to do something else and in this case I'm just going to say value just whatever value isn't here just in other words if this goes nuts go to this and so closed bracket and so now as you can see the error disappeared and it works just fine number five is has parent and so for this will be we're creating this example and so here's what I have I have just equal media logo and it's not parented to anything but if I parent it let's say to the left null it goes to the left null if I burn it to the right it goes to the right and if I set it to none it will just go back to my original position to whatever value I have in here so let me show you how to recreate that using expressions so I'm going to hold alt click on the stopwatch to get rid of my expression to start fresh and hold alt click again on stopwatch to start a new expression and in here I'm going to do if statements I'm going to say if and then the parentheses I'm going to say if I let's do this this layer period has parent so basically I'm saying if this layer has parent open bracket here's what I want to do if it has a parent I want for the position to be 0 on the x-axis and 0 on the y axis and so that's what I want to happen when it has parent but if it doesn't I'm going to say else so if it doesn't I'm going to set the position to the current value whatever value is whatever value have set in here so let's see if this works so right now if I parent you know right now it's not parented so it's just it has whatever value that is in here but if I pair into the right it goes to the right if I parent it to the left it goes to the left number 6 is else if and that one is basically like an add-on to if statement and let me show you like a practical example and by the way we'll be recreating this so right now I have just a text and a few checkboxes so if I select one of these checkboxes let's say a you can see that it changes to ten and if I select B it changes to 20 and C changes to 30 so let me show you how to set this up using elsif so I'm going to go to the source text and hold alt click to get rid of my old expression and alt click on the stopwatch again to create a new expression and right now I'm just gonna define each check box so I'm going to say a it can be anything but I'm just gonna say a you're going to be a check box and then B you're going to be B check box and then see you'll be C and the next will do I'm going to use an if statement so I'm going to say if and then in parentheses I'm going to say if a which we know the a refers to the check box if a is checked so if check box is checked I want four to do this I want for it to be 10 else else I want to say and if it's not checked I want to say select check box okay and then close bracket so but as soon as I let go you'll see that I'm going to get in there as you can see we have an error but here's a problem because in After Effects if you want for the text to be just a text you need to put it into quotation so basically need to make that a string and so when you do that it just reads it as a text but if you don't it just thinks it's part of the expression or something like that so when I do that you can see it's working fine because nothing is checked so it's referring to this select check box but if I select my a check box you can see that it changes it to ten all right but so how do I add these other two so right now if statement only allows me for one but how do I add more so this is where else if comes in very handy so now I'm going to say else if and in the parentheses I'm going to say if B is checked I want for it to be 20 so now if I go and select B it's going to go to 20 and with else if we can you can do as many of them as you want so I'm going to select this and do control C and copy that and then do control V and instead of B I'm going to change that to C so now if C is checked I'm going to basically change this to 30 so I went for it to say 30 so now if I change it to see it shows 30 and it's pretty cool because you can do anything in there you can say again make sure it's in the quotations I'm with a euchre Mediacom so if C check box is checked it changes to communicate comm number 7 is a function and this one is a small one but it's very useful in fact I want to take a couple minutes just to explain it to you so you get it because I think you'll find it useful as well so let me start out by you know going into the source text of my text layer here and I'll click on the stopwatch here and now I'm going to type my expression in here so I'm going to define my function here so I'm just going to say let's do this function and then next you can type any name so I'm going to say euchre media but it can be anything and then in parentheses I'm going to say I'm just going to put n it could be anything but I'm going to say n for number because you essentially going to replace it for a number it will definitely make more sense as we go so I'm going to do Open bracket and so inside here so now we have our function and return and so now we can type in our expression here basically what is it that you want to run in this function so I'm going to say this in whatever number is in here that we put in here I want to add let's say under to it and then I was do closed bracket so again nothing's really happening here but if I type in less than 5 we see our number 5 but I can run this 5 through this function so I can say euchre media and then in parentheses I'm going to put 5 and so what it's doing is going to take this 5 in our function we have n but it will replace this n for five and basically be 5 plus 100 so essential we'll see other than 5 so let's see if that happens and as you can see it did happen so how why is this useful this could be useful in if you're writing expressions and stuff if you have something long and you don't want to keep writing it over and over so I mean we can add on to that so we can say plus let's do like a string so let's do plus let's do space bass bass C euchre Mediacom and as you can see we'll do that I mean the sky's the limit what you can do with this but also you can do if statements with this thing so instead of return we can do let me do this first I'm going to say time times 20 and as you can see it's working and let's surround this up using the math round so essentially that's a function - and so now we just have a number going like this but what if let's say when it's a single digit I want to add a zero to it so that at all times it's always two digit number so here's where we would use that if statement so in here I'm going to say if and then parentheses I'm going to say if this number that we put in here is smaller than ten if it's more than ten returned meaning I want four to add a string out of zero to it so 0 plus n else return and if it's not I want for it to just add nothing to it you kind of have to do it this way so that will work so if I type in my you commedia function and put that stuff inside the parentheses you will see that if I go below it adds zero to it another thing about point out here is that you can name your function two ways so this was one way but there's another way you can do it is by simply typing you clear media and then equals and then you can say function and that will work as well number eight is a sample image and so let me show you how powerful this thing is so for this example we'll be creating the so I'm going to select this no and if you notice whatever this Knoll is hovering over whatever color it changes my circle for that color so let me show you how to set this up using expression so I have this circle and I already have this color in there so I'm going to get rid of the old expression and I'll click on the stopwatch again to create a new one and so now I'm going to define some things I'm just going to say target position and it's going to be pick whip to this thing so that's going to be the position and then I'm going to do colors so it's going to be this layer right here and I think this is this right now so let's type our expression so I want to say colors so we're talking about this layer right here period and then I want to go to this expression helper here and and go to layer and then general and this very last thing sample image and just click on that and you can see that it adds that to our expression and so now we can keep going so instead of this point in here we need to define this point because right now it's not it doesn't know which point it is so I'm going to copy this and define this point in here so I'm going to say the point you are and then I can say target position and so now if I let go this it should work so if I stood like this target and just move it around you can see that it changes our circle to whatever color that we're hovering over number nine is time conversion and let me go over some of them because I think you'll find it useful so I'm going to go to this text me here and I'll click on my source text and in here I'm just going to type time and that's what happens when we do time you know it's it's just time but what if I want to convert time to frames so this is where time to frames comes in handy inside here I'm just going to say time and then define my frame rate so it's 29.97 at the moment you might have it differently and so now if I switch control click on here you can see that it shows me frames so that's time to frames and then let's see if I let's do this so I'm going to say frames define that's frames because we're going to use it for the next example and so now I would say what if I want to do frames to time so I'm going to say frames to time and inside there I'm just going to say instead of time I'm gonna say frames because we know this thing has frames in that time so and then I will do the following so again 29.97 define our frame rate so now you can see that it picks it back to time all right the next on the list is time to time code so if I just get rid of this and do time to time code and then in here we'll do the same thing we'll just do time and then the frame rate 29.97 and as you can see we see the time code which can be very useful so that's the third one and the fourth one will do time to current format so let me show you I'm just going to type time to current format and the same thing in here we're just going to say time and then define our frame rate and so now if you if you let go you can see we're in frames right now so we're seeing frames but if we control click on here and switch it to seconds you can see that we have a different time code number 10 is a velocity at time and speed at time and those are somewhat similar but yet different and so the difference between velocity and speed you know velocity has you know speed and direction so it has it could be negative number it can be positive it also could be two-dimensional three-dimensional stuff like that so but speed it only has one number and it's always positive so let me show you like an example here so I'm going to select this text here and just all click on the source text and we're just going to type stuff in here so you can see visually what's going on so I have by the way before we do that I have this layer and here this text layer and it's animated so we just we have like a practical example so just a two keyframe animation nothing crazy so I'm going to pick whip to this position you can see here's a position you know you can see numbers but if I I can add to this position I'm going to say let's do speed at time and then inside parentheses I'm going to say time and so now it's going to give us the speed of this text so this is the speed and as you can see it's just one number and it's positive we have some you know we can round it up using the math round expression or function but the usually just one number so but if we change the speed to let's do a velocity watch what happens so now you can see that it's negative and it has another didn't dimension to it so it's two-dimensional and yeah that can be a bit problematic or it can be you know it depends on what you're going for but let's say what if you want to just this x-axis you know you would just do index zero at the end of it and it will just give you the one number or what if let's say you wanted to for it to be positive so then you can say you can do math dot abs and in parentheses you put that value in there and I'll make that number positive and you can even go further and let's say what if you just want that number you can do math that round and like this gets crazy but that's the idea and that by the way all this stuff I did go over in the first part of this tutorial so check it out it's a different video you'll have to find it on UK mediacom or on this youtube channel but yeah so this is what velocity and speed does but let's see a practical example of this so I'm going to erase this and then go to this position or this text and I'm going to bring in this slant effect so then and what it does basically slants it a little bit so I'm going to use speed for this but you can get an idea how you can use both so I'm going to alt click on the slant and I'm going to type I'm going to link it to the position let's wait let's select this Lent and hit ask twice to solo it and then hit P our shift T to add position and I'm going to just go into this expression in here extended sum and then I'm going to pick whip to the position and then I'm going to say all right instead of this position 0 I'm going to do period and so I'm going to type speed at time and then I miss you time it's going to be crazy right now you'll see it's going to be nuts yeah because we need to divide it by like maybe ten or so come it down a little bit so you see how it's slanted as it comes the speed it applies that speed velocity on top of this value you can actually see the value what it's doing so that can be useful for some things and let's copy this it may bring in like a directional blur and put it on top of this text and then maybe put it like 90 degrees make sure it's the same direction and basically I'm going to do the same thing for this directional blur you're going to add an interesting fill to it I'm going to go into here and select this blur length hit s twice to solve it I'll click to activate the expression and I'm going to paste that same expression into here and you can see there you go you can see how give it an interesting seal so yeah this is basically velocity and speed in a nutshell number 11 is comment and this one is very useful if you're working with a lot of people or if you're ending your project over to somebody else and you have a lot of expressions and you can you know with this common thing you can leave notes in your expressions label things and it can definitely clear out a lot of headaches so let me show you how to use it so I'm going to select this logo and hit R to reveal the rotation property I'm going to hold alt on my keyboard and click on a stopwatch to add an expression and so I'm just going to type the time times so let's do like 30 and we just have a simple rotation here but what if I want to add like a like a note to this saying like hey don't change this value or something like that so to do that you will just do two forward slashes and then you can say anything like don't erase this and then if you like go you know it's still there you can even label things maybe like this could be like you can say like time expression or something like that so you can see how useful this can be but the problem with this comment what if let's say I want to leave two lines or three or four in other words multiple lines so let's say I'm going to just type random stuff look what happens so I get an error and if I condense it down to one line it works fine so how do I do multiple lines and to do that it's easy just do forward slash and asterisk and then you can type anything you want and when you're done you just do asterisk and forward slash again and there you have it number twelve is in point and the out point and so let me show you how awesome this thing is so for this example I just have text and myuca Media logo so I'm going to select the stacks first and go into the source text I'll click on the stopwatch to see basically I'm going to show you visually what I'm doing here and so first I'm going to do let's type in in points and automatically you'll see that it will give me the end point of my layer so it later has in an out point so it basically tells me where this end point is on the time line so if I put it let's say at two seconds if I will select this and do alt open square bracket you can see that it will snap this end point to two seconds so now I can see that it's at two seconds or if I put it back at one and stuff like that so you can see how it basically gives you the value of your end points on your timeline and so the same thing applies for out points so if you type out point you'll give you you know and now it's at six seconds so you can see it's there but you can move it around and stuff like that but this information is pretty valuable by the way if you want to refer to another layer you know you can just you know pretty much drag this pick whip to let's say this logo in here and then you can just say period and then do end point and it will do the same thing you know I'll tell you the end point of that layer so let me show you a practical use for this so I'm going to collapse this down and I'm going to select my logo here I'm gonna hide that and then hit C to reveal the opacity and so I'm going to alt click on the stopwatch here and let's do like a basic linear expression so I'm going to say linear and then inside parentheses I'm going to say time I want a starting point to be in point and that ending point I want to be in points plus let's do half a second point five and so when it's in points I want to be zero and when it's here I want to be 100 so now you can see that at the beginning it's nothing new I can't I can't see my logo so when I play it reveals itself so what's cool about this it doesn't matter where my endpoint is it will always start there so that's that's pretty awesome so the same thing applies for out point so if you just type instead of in you do out it'll fade out and stuff like that but let me show you how to do it this way so in fact let me do this so I'm going to define this as a so first will be a and then I'm going to copy this thing here and then paste it here and then just change a to b and then in two out on both okay and then instead of plus five I'm going to hypest in fact I'll cut it so and I'll add it to this one here and instead of plus I'll do - so let's subtract so for the end so now I just want to do this I'm going to say a minus B and so if I play this at the beginning you can see that it fades in and at the end it will fade out and it doesn't matter where you place it it will always do that based on this equation number 13 is smooth and it does exactly what it sounds so let me show you what I'm talking about here I have this logo in here and I applied a wiggle expression to the x position and then I baked it into keyframes so now you see this Wiggly animation and if you look at the graph editor you can see my curve rights all over the place it's pretty rigid so how do i smooth this out using this smooth expression so I'm going to get out of to add the graph editor and I'll click on this stopwatch for my position x position and inside there I'm going to go here property and then select a smooth and so let me go back to the graph editor and what it does and by the way I'm going to check the sauce expression graph and it basically shows me what the expression is doing so this middle line is the expression and the outer is basically what the keyframes are doing so the width basically what it does it kind of shows you how many seconds to evaluate your keyframes to the left and right so you know the smaller the number I'll say if I take it to 0.1 it'll be more like the original curve that you had or you know movement and if you take it to a 3.5 it's going to look completely different so I'm going to undo that so I'm going to keep it maybe at point two and the second one the samples you basically telling the curve or whatever how many keyframes to evaluate so if five you know the more keyframes you have the more smooth the curve will be so if I take it what's up to 15 you can see that it's pretty smooth and you can actually maybe instead of two maybe I'll do point one five and you can see it's more similar to the original one but it's a lot smoother and now if you play it it's pretty smooth number fourteen is a look at and it's a very simple let me show you how to use it so for this example I want this arrow to point at the logo the whole time and it is important that both of your layers are in 3d so I'm going to select this arrow hit R on my keyboard to see the rotation properties and I'm going to alt click on the stopwatch of this orientation property and inside there I'm just going to define top my target so I mostly target and my target is going to be this vector logo and then I'm going to say look at and inside my parentheses I'm going to say target transform position so basically the position of my target and then I'm just going to say the position of the current layer and I can just say transform period position and so now it kind of works so I have this I can move it around but it's just on the wrong axis so you just have to make sure to go to a wire rotation and set it at negative 90 and so now it points right at your logo so you can move it around and you can see it's working quite well number 15 is posterized time and this one is very easy and quick for this I'm going to use this you can media logo again I'm going to select it hit R on my keyboard to review the rotation property and alt left click on the stopwatch to activate my expression and in here I'm going to type let's do time times like 160 or something like that so you can see it's rotating which is exactly what I want and the next what I'll do I'll apply this posterized time expression right before this time expression so I'm just going to type poster rise time and then in parenthesis I'm going to type the frame rate that I want so for example I'm going to do something alone maybe like six and as you can see it gives you that stop-motion effect number sixteen is from comp and the front world and let me show you what it does so for this example I have a target in here just I just created with using shape layers and if I play it you know I applied some wiggle expression to the position so it's wiggling it's working nicely it's doing exactly what I wanted to do but I'm going to bring in a new solid into my composition I'm going to do control Y on my keyboard to bring a new solid and I'll make sure that it's my you know the comp size hit okay and so now I'm going to drop it right underneath my target here and I'm going to drop this right on a fact right on top of my solid and I'm going to label this right on and in here I'm going to change the color to like a orange color maybe a bit darker and then I'm going to change maybe the size to like 16 or so something big maybe not that big let's do this is like 14 okay you can see there's a small nut and I'm going to push this brush spacing to something like that and so now if I play nothing happens but I'm going to link in if I had ysou like this solid hit e to see my effect and I'm going to select the brush position of my right own hit s twice on my keyboard to solo that and then I'm going to alt click on the stopwatch and parent this to the position of this target and watch what happens it works nicely just like you would expect but what happens you know the reason why it works so nicely because we have you know the composition size and this solid size are identical and so it works fine so but if you would you know if you would have something like a solid that's smaller than this you know if you scale it just scale this down you can see that it's not working well or if you you know shifted over here you can see that it's not working well so it only works well if it's in the perfect place and stuff so what what happens if it shifts how do you link it up again and so this is where from comp from world comes in handy so I'm going to use the first one from comp so I'm going to do from comp and then open parenthesis and closed parenthesis and so now I basically put this expression that we had earlier inside this from comp and let's see what happens and as you can see that it works quite nicely so now it doesn't matter where I move this it will still match up and it will be great but what happens when you make this right on solid a 3d and as you can see is just not working so this is where from from world comes in handy so from world deals with 3d so I'm going to change this to from world and so now if you preview this you can see that it's working quite well 17 is from comp to surface and so for this example I'm going to pick up where we left off and I know we've done a bunch of stuff to this right on solid so I'm going to do one more thing to it and see if we can fix it so we've done we converted this to 3d and we were able to fix it using from world so now what if I take this solid and hit R to reveal my rotation what if I just rotated just a different axis so like maybe something like this it looks awkward and if I preview this you can see that now it's not lining up even if I have you know from world so how do I fix that and it's really easy all you have to do is just use this from comp to surface so I'm just going to type instead of from world I'm going to do from comp to surface and let's see if it works and it's working great number 18 is key and with this one I'm only going to scratch the surface but let me show you some of the things you can do and I'll also finish it with just a practical example but for this I have text and a circle for my background here and the text actually has two keyframes so it animates from the side like so and I'm going to actually go into the source text of my text and I'm going to off click on the stopwatch here so you can visually see what I'm doing here so I'm going to let's say I'm going to refer to the second keyframe and to do that I'm going to pick whip to the position so because it is in the position property and then I have this index I'm going to get rid of and I'm going to hit period to keep going so now I'm going to type key and then parentheses I'm going to define which key I want so it's based on index so here's index one two so I want the second one so I'm going to type two and and I need to keep going because what do I want from this key and if you go to this expression helper and the key you see like some of the options in here so you can either grab the value time or index let's play with the value first so right now it's going to show me the value of the second keyframe so if I like go you can see 960 540 and that's exactly what I'm seeing in here but if you change that to let's say time it's going to show you the time of this keyframe in other words where it's located in the timeline so if you move it around you can see it's changing and it's based on the seconds so that's time and the third one is index but it's not very useful for this example because obviously we are referring to the second index so it's going to give us two all right so that more has to do with mirrors key which I'll show you here in a second so in fact I'll do right now so I'm going to show I'm going to type nearest key and instead of two I'm going to just type time so right now whatever key I'm closest that's what it's going to give me the index of that key so if I'm closer to this one is going to give me one if I'm closer to that one it's going to give me two so that's what that index does but let me show you a practical example of this of what we just went over so I'm going to delete everything in here and so here's the animation and I'm going to go into the position of this circle I'm going to right-click on the position and do separate dimensions and I'm only going to focus on this exposition so hit s twice to solo that and I'll click to activate the expression and so in here I'm going to pretty much define a few things I'm going to say let's do key time and so key time it's going to be basically that this is this position I'm going to grab key index two and what I want from that obviously it would be time so I'm going to say periods time and that's pretty much it and the second one I'm going to do key let's do a value and so in here I'm going to grab the same thing grab this position and key and I'm going to refer to the second one again and instead of time I'm going to do value so value and because it's a two-dimensional value I need to refer which value I want I want the exposition so it's going to be 0 index 0 so I'm going to do index 0 and now I'm going to do a linear expression so I'm going to linear if I let's do YZ YZ and then in parentheses I'm going to say time and then I'm just I'm obviously going to start from 0 and then in here I'll type key time basically because it's the time of the last keyframe so it's going to end where the last keyframe ends so that's that and then I want it to go from 0 actually let's do from like 400 negative 400 to do key value to the value of this keyframe so if I let go and just preview this you can see that what it's doing here is awesome because if I just move this keyframe let's say over here the animation will line up or if I let's say move the the text itself if I select the text and just move it over here you can see that the animation will line up based on that keyframe value and time and the last one is a marker key and it's very similar to the key one but instead of dealing with keyframes it deals with markers and in fact again I'm only going to scratch the surface with this one but for this example I have you know just a text circle again and I have a bunch of markers on you know my text layer and the circle layer and also in the composition here so let me show you some of the things you can do with it so I'm going to select I'm going to go into this text source text I'll click on the stopwatch to activate the expression and that way you can see visually what I'm doing and I'm going to refer to this second a marker in my current on my current layer so what I'm going to do is just say marker and then I'm going to say key and now I have to refer which marker I want so again index two so we want that second one and in here you know you can still do time and you know it will give you the time of that marker you can move it around you can do index you know just tell you it's the second one you can do value again the same stuff as we did earlier and I'll just tell you that but you can also do more you can go over here to marker key and select any of these and so for example I'm going to select the duration of that of this marker and it's going to say zero because there's no uh no duration going on right now but if you hold alt click and drag you can see that now it has changed so and again all these options that you'll see in the key marker or marker key you can if you double click on the marker you can have it in here so if you select let's say chapter 22 and you refer to chapter you know it will give you 22 so you get the idea how this works and let's say for you know the same thing applies for nearest key so I'm going to do nearest key instead of two I'm just going to say time and I'll say if I want the index of it so now if I am close to the second one I'm going to get you know index 2 1 3 so you get the idea but what if let's say I'm referring to the 1 and this on my current layer but what if I wanted to refer to something in another layer like this one what if I want the third marker in this on this layer so to do that I'll just do you know pick whip to the that layer and then I'll keep going so period and I'll say marker period key and then I'll refer to the third index so that we want this third marker and then I can just grab whatever I want like let's say let's do time I want the time a bit marker so give me the time I can move it around and it's fine but what if would say I want to refer to the markers not on any layers but in my composition and to do that I'm just going to do this instead of you know I'm going to refer to the finished one so - and I'm going to say is this comp and that's it and it will refer to that one right there if I move it around you can see that the value is changing and you know you can I think this is common so you can go over here and select the comment and they'll tell you that finished comment so you definitely get the idea of what I'm doing here but let me show you a practical example of all this so I'm going to alt click on a stopwatch to get rid of my expression and I'm going to right click on this position and separate my dimensions and now what I'm going to do for the exposition I'm going to select it and do hit s twice to solve it I'll click on the stopwatch to activate my expression and I'm just going to do the easy expression again so I'm going to do time and then I'll do from zero to one second and I want to go from negative 400 to current value and so let's see what happens so you can see it just animates in but what if let's say a one I you know in and outpoint to be based on start and finish so to do that I'm going to do I'm going to say start and I'll refer to that marker so I'm going to say this comp and then I'll say marker key and that's key one and I want so it has to do with time so I want the time of that and then I'll do finish and the same thing this comp marker and then key and instead of one I'm going to do this the second one for the finish so two and I want the time of that as well and so now instead of zero one I'm just going to say start and finish and let's see if this works so here's the first one it starts right there and finish it there so if I move this let's say over here you can see that it's going to go all the way to that one and if I want to start in here you'll see that I'll start Zack let's see a better visual here it's starting there and hence in here alright thank you so much for watching this tutorial I hope you found it useful if you would like to get the project file from this tutorial you can download at Yuka Mediacom I'll link with the link at the bottom of this video and again make sure you subscribe to this YouTube channel like the video share it you know add me on the social media and also we have a mentoring group on Facebook that are full of all kinds of creative people that are helping each other I think today we have about 1,000 some people so definitely they're all passionate motivated and they would love to get to know you so definitely go there the link is at the bottom of this video and again just a reminder you can purchase module or lower third kit at Yuka Mediacom /op and until next time my name is Sergey Prak Nevsky and this is Yuka Mediacom [Music] [Applause] [Music]
Info
Channel: ukramedia
Views: 81,494
Rating: undefined out of 5
Keywords: ukramedia.com, Sergei Prokhnevskiy, motion graphics, expressions, After Effects, Adobe, useful, scripting, modulus, active, enabled, parent, try, catch, hasParent, Else if, function, sampleImage(), Time Conversion, velocityAtTime(), speedAtTime(), comment, smooth(), lookAt(), posterizeTime(), fromComp(), fromWorld(), fromCompToSurface(), key(), marker.key(), helpful, tutorial, video, lesson
Id: VgoUQ3eubD0
Channel Id: undefined
Length: 50min 43sec (3043 seconds)
Published: Tue Jul 04 2017
Related Videos
Note
Please note that this website is currently a work in progress! Lots of interesting data and statistics to come.