Create a Mograph Style Effect in After Effects

Video Statistics and Information

Video
Captions Word Cloud
Reddit Comments
Captions
- Hello again. Joey here at School of Motion, and welcome to Day 28 of 30 Days of After Effects. Today's video is going to be pretty cool and there's going to be a lot of expressions in it, but in the end what you're gonna end up building is a rig that in many ways resembles MoGraph from Cinema 4D. Motion graphics artists love MoGraph because it lets you do stuff like what's going on behind me with not that many keyframes and minimal effort, and it's easy to tweak. In After Effects, there are some plug-ins that can replicate the MoGraph module, but actually, this is one of the fastest and easiest ways I know to build animations like this. There's a lot of advantages to doing this way that I'm going to talk about. Now, if you're into making repetitive animations, and cool geometric things like this, you're gonna like this video. Don't forget to sign up for a free student account so you can grab the project files and expressions from this lesson, as well as assets from any other lesson on the site. Now let's hop into After Effects and get started. So this one is pretty cool. This is somethin' that I've started doing a little bit more in After Effects, which is tryin' to recreate some of the functionality of Cinema 4D inside of it. For those of you that haven't used Cinema 4D very much, there is this big area of Cinema 4D called MoGraph, which lets you, very easily, make repeating animation like this. Sometimes I call it cascading animation because it's animation that's simple, right, but it's just offset, right. So if you just look at each piece of this, like these little pink balls that fly out of the center, the animation of each one is very simple, but what makes it cool is they're all offset. And look at these triangles, these blue kinda triangles, they're offset too, but in a random way, it's not in this, like, linear way. So I'm gonna show you how to build a system and I gotta warn you, this is an expressions sort of based technique, but it's actually not as complicated as you'd think, and if you're getting into expressions, this is actually a really good technique to try and use as a way to figure out expressions better. So what we're gonna do is we're gonna make a new comp, and we're just gonna call this Dot. So first thing we need to do is create some animation that we can then replicate and create this cool cascading animation with. So let's make a circle, and it's very important because of the way this is gonna work that we are very precise with where we put things on screen. So I want a circle right smack-dab in the middle of the screen. So I'm gonna double-click on this Ellipse tool. And this is a little trick I use because what happens is it will then put an ellipse right in the middle of your frame, right in the middle. And now if I go to the Ellipse path, and I set the size to 1080 by 1080, now it's a perfect circle and now I can shrink it down and now I've got a circle directly in the center and I know for sure that the anchor point is right in the middle. All right, so let's get rid of the stroke, I don't want a stroke on that, I just want a little circle just like that. So let's just do a simple little animation on this. Let's have it, let's have it move from the center out to the right somewhere. So let's separate the dimensions, put a keyframe on X, let's go forward, I don't know, 16 frames and scoot way over here, easy easy. And of course we don't just wanna leave it like that, we wanna pop in here and we wanna add a little character to this. So I'm gonna have it, I'm gonna have it overshoot a little bit, okay. So let's have it overshoot and swing back, maybe it overshoots back the other way a little bit, and really we just want something that's gonna have a lot of movement to it, so that when we start cloning it and offsetting the animation, it'll look really interesting. Okay, let's see what this looks like. Cool, nice little animation there, beautiful. And then I don't want the dot to just appear in the middle, I want it to sort of animate on, so let's also animate the scale, and let's just go to like, frame six, make it 100% there, and at frame zero it's zero percent scaled, so now it'll just sort of scale up as it animates on. Piece of cake. All right, so there's our animation. So here's what we're gonna do. Let's now make a new pre-comp, and let's call this Dot_MOGRAPH, and let's bring that Dot animation in there. So what we wanna do, is we wanna be able to duplicate this a bunch of times, right, and have each one be slightly offset, like this, right? And we want them to sort of create this radial kind of array, and then we want each one to be offset in time a little bit, right, so we can get this cool cascading thing. Now, you can do it manually, of course, but that's a pain in the butt, and that's why God created expressions. Or, I don't know, someone at Adobe, it wasn't really God. So let's think about this. What are we gonna need in order to make this happen? Well, for one thing, we're gonna need an expression to automatically rotate our layers for us, so that they are rotated correctly, right? And there's a pretty neat way we're gonna do that. On top of that, we're gonna need an expression to offset the time of these layers for us, and for that we're gonna wanna probably be able to set the delay of each layer ourselves, so we're gonna wanna a control to be able to do that. We also may want these things to animate on kind of using a random time offset instead of having this one be one frame later, this one be one frame later, we may want them to be a little more random, and have random timing. And so we may wanna be able to also set the total randomness. So the rotation can be set automatically based on how many of these dots there are. If there's two dots then this one needs to be rotated 180 degrees. If there's three dots, well, then this one needs to be rotated 120 degrees and this one needs to be rotated 240 degrees. So we wanna automatically be able to set that stuff. Ok, so, here's what we're gonna do. We're gonna make a null, and we're gonna call this MOGRAPH-CTRL. So this will be our controller object, and we don't need it to be visible. We're gonna add, in the Expression Controls we're gonna add a slider control. We're actually gonna add two slider controls. So the first slider control is gonna be the TimeOffset, and we will have this work in frames, okay. And then I'm gonna duplicate this and we will have a RandomTime in frames. And I wanna be able to set both, so we could have, we could have the animation happen in a cascading fashion, like counter-clockwise or something, but we could also have it be slightly random, I wanna have the ability to do both. So first let's talk about the rotation. So this is gonna depend on having one layer that is sort of our reference point. So what I'm gonna do is I'm gonna duplicate the Dot, so now there's two, I'm gonna make the bottom one a different color, and I'm gonna call this DOT-MASTER. Now this one, I'm gonna rename it to DOT_01. Now it is helpful if you put a number on the end because if you do, when you duplicate this, After Effects will automatically increment the number for you. So that's just like a nice little trick. So we're gonna put an expression on the rotation of DOT_01, and what we need that expression to do is figure out how many dots there are total in the scene, figure out okay, well, there's two dots, so how much do I need to rotate this dot so that it will create a 360 degree circle? So let's talk about how we're gonna do this. Here's our expression. Hold Option, click the stopwatch, now you can enter an expression. So we first need to know how many dots are there total in the scene. Okay, now how can we figure that out? Every layer in After Effects has an index, that's this number right here in this column, so if we know that the master layer, whatever layer's at the bottom here that we're basing a lot of information off of, we can look at the index of that layer, because that's always gonna be the biggest number. This, right now, this has an index of three. Now if we take three and we subtract one from it we know how many dots there are in the scene, and we're subtracting one because we don't need to know about this null. This null should not be counted in this equation, and if we duplicate this, now this becomes index four, so you subtract one, you know there are three dots in the scene. So the way we can figure out the number of dots is by looking at this layer, so I'm gonna Pick Whip to this layer, and I'm gonna type in .index, all right? When you're writing expressions you can Pick Whip to a layer and then add a period and type in a variable name to get information about that layer. So I want the index of this layer, okay? And then I wanna subtract one. So that's the number of dots in the scene. So right now there are two dots in the scene, so the number of dots is gonna equal two. So how much am I gonna have to rotate each layer? Well, so my layer rotation is going to equal 360 degrees, which is a full circle, divided by the number of dots. All right, so now we have a variable called layerRot, layer rotation, which has a value of 180. And if I duplicate this and now there's three dots, this is gonna have a value of 120, so this is always gonna be how much each layer needs to rotate. So now what I need to do is figure out how many times do I need to rotate by that amount? What I mean is, if there are three dots, well then this dot needs to rotate one times this number, and then the next dot needs to rotate two times that number. So I basically need to find out how many dots away from the master dot am I, okay? And the way you can do that is you can subtract the index of the current layer, whatever layer you're on, from the master index. So if you say myIndex equals, all right, so Pick Whip to the master, type in .index, and then subtract the current layer's index. To get this layer's index, all you have to do is type in index, okay? So, again, myIndex is the master layer's index, three, minus myIndex, which is two. So this myIndex variable is actually gonna have a value of one, and if we multiply that number times this layer rotation number, we are going to get 180. What's amazing about this little expression, and I hope you guys understood that, I hope that you grasped that, type it in, break it down, really try to understand it, 'cause here's the amazing thing: if I duplicate this now it's gonna automatically rotate every single layer to make a perfect circle no matter how many copies of this I make. There you go. So that's the rotation expression. And I can see that these are, the circles are poppin' out too far, so I need to go into my pre-comp here, and let's look at the Exposition, here we go, and I'm just gonna bring all this down a little bit. Awesome, cool, okay? And again, this is amazing, I just duplicate as many times as I want, and if I say, you know, I only want ten dots, there you go, rotations handle automatically. Now let's talk about this stuff, the time offset. So what I need to do is I need to have a way of setting the time that we're looking at each of these pre-comps, right, so the first thing you need to do is select every dot, and enable Time Remapping, so the hotkey is Command Option T, or you can go up to Layer, Time, Enable Time Remapping. So now I have a property that I can put an expression on that will let me kind of offset these. So let's start by making this easier. Let's get rid of all these dots. Okay, so here's what we want. We want the time remap of each of our subsequent dots, we're not gonna put an expression on the master, remember this master is like a reference for us, so we don't really need to have any expressions on that. But what I wanna do is I wanna look at whatever this time remap value is of the master, and the good thing about a time remap property is that it's automatically gonna go up, right, if you don't mess with these keyframes at all this is gonna tell you exactly what time on this layer you're lookin' at. So what I could do is I could have this time remap look at this time remap and say hey, whatever this is set to, I want you to add whatever this time offset is. So instead of 314 I want it to be 315, so it'll be one frame difference. So here's how we're gonna do that, okay, and I'm gonna walk you through a coupla steps here. So first we'll put an expression on here, and actually before I do that I wanna make sure that I open up the sliders on my timeline so that I can Pick Whip to them. All right, so we're lookin' at this expression, so first thing I'm gonna do I'm gonna say my timeOffset equals, and I'm gonna Pick Whip to this, and now I need to something very important. When you are, when you are working in an expression in After Effects on anything that relates to time, you are not gonna tell this property what frame you would like, you have to actually tell it what second you would like. So I don't wanna have to think in seconds up here, I wanna say I want this delayed by two frames. Well down here, the number two actually equals two seconds, so if I want to convert that into frames I need to divide by the frame rate. So my frame rate is 24, so I'm just gonna put divided by 24. Okay, so I'm takin' this number, I'm dividing by 24, so now my timeOffset is in seconds. So then all I need to do is say well, look at this layer, right, so this layer's time remap, and that is the sort of base time, so the baseTime equals this. And so then I need to figure out that same variable that we figured out for rotation if you remember we needed to figure out the difference between the current index of this layer and the index of the master so we know how much to multiply that number by, that rotation, okay? So we're gonna do the same thing with time remap. We're gonna say myIndex equals, and we're looking at this layer's index and subtracting our index. So then what we can do is we can say, all right, what I wanna do is take the baseTime and I want to add myIndex times the time offset. Cool. So what this is doing in sort of English is it's figuring out the time offset, which right now is zero, so let's just set the time offset to two frames. So it's saying the time offset is two frames. The current time we're lookin' at here, lemme go back to the beginning here so you can actually see it. Now this is actually offset by two frames, cool? So it's saying, and you can actually see here that now this is two frames ahead, so actually want I wanna do is set this to negative two. There we go, cool. Two frames offset. So the time offset is two frames, the baseTime, the current time we're lookin' at, is 19 frames. And myIndex is three minus two, so one. I am the first dot that comes after this master dot. So I wanna take myIndex, which is one, and I wanna multiply it by the offset, so the offset's two frames. So that's all we're gonna worry about is two frames, and I'm gonna add that to the baseTime to get the correct time. And what's great is now, if I duplicate this, right, because we are figuring out the index of this dot, and multiplying that times the offset, it's gonna automatically offset every single dot by two frames. So this expression is not very complex, I mean, what I find a lot with expressions is, look at this, it's four lines, and you could probably do it one line if you wanted to, this just makes it a little easier to read, it's not knowing the expressions that's hard, it's understanding how to think like a programmer, you know, like figuring out just logically how to make this stuff work, and the more that you absorb, the better your brain's gonna get at doing this type of stuff. Cool, all right, and so now we can just duplicate this as many times as we want and you get your time offset, and it's automatic. And now here is one of the amazing things about this technique and one of the reasons that it's so powerful is, you know, if you were gonna do this manually, the absolute smallest amount that you could offset one layer from another layer is one frame. What I mean is, if you were just doin' this manually, like this, you can only have one frame, that is the minimum distance you can move something in After Effects, right? So if you wanted all of these things to cascade out like this, and there's, you know, there's 14 dots here, if you wanted that to take less than 14 frames, it would be impossible. Or you'd have to do it and then pre-comp it and then time rehab it. With expressions, though, you can offset things by less than one frame. And so now, and you can even see in real time as I adjust this number, it's pretty slick, I can have this be offset by one tenth of a frame, so you get a really tight little spiral like that. And this is something that you honestly are gonna have trouble doing if you try to manually move layers around and do it that way. It's just not as easy. But with this little setup it become so simple. Cool, so now we've got the time offset part. So now let's talk about the randomness. So let's set the time offset to zero so they all pop out at the same time, and let's talk about the randomness now. So randomness in expressions is really powerful and it lets you create all kinds of cool behavior where you don't even have to think about it. So here's what we're gonna do. We are going to hop back into our time remap expression, and we're gonna add a little space here and we're gonna start workin' on the random part. And I need to make sure that I can see this slider so that I can actually Pick Whip to it, so. All right, so what we're gonna say is our randomTimeAmt, you can name these variables whatever you want, is this, okay, so we're grabbing that value, and remember, we need to divide by 24 because we need this number to be in seconds, okay? Okay, so now if we think about this, if we set this to two frames, what, to me, what I really want is, I want that to randomly change this time remap, either or backwards two frames. I wanna have it go both ways, okay? Now, here's how you do randomness in After Effects. It's actually pretty easy. So why don't we say the randomActual, okay, so this is gonna be the actual random amount that we're gonna choose here is going to be, and here's how it works, okay, and if you forget this you can always click this arrow, and look in this little popup box, so here's the random numbers group, and you can see all the different expression commands that deal with randomness. And random is the easiest one. So all you do is you type in random, and then you put the minimum and the maximum number that you would like random to give you. So I'm gonna say random, and then in parentheses, so the minimum number I want is the negative randomTimeAmt, and the maximum value I want is randomTimeAmt. Okay, so, this random command is actually going to give me a number somewhere between, if this is set to two, let me actually set it to two, randomActual is going to be a number somewhere between negative two and two. So then all I have to do is take that number and add it to this expression here, and now I will get my time offset will be sorta taken care of, but then if I have any randomness, that will also be taken care of. So lemme crank this number up, all right, and you can see that now this, and actually lemme just go ahead and delete all of these really fast, just go back down to two dots. So look at the time remap here and you're gonna see somethin' funny. All right, you see how the animation's all messed up now? And if you look at the time remap, at the actual value, if I go frame-by-frame through it, you see it jumps around, right? So when you use random numbers in an expression there's one extra step you have to do. And that is, you have to seed, it's called seeding, you have to seed the random number. So for example, if you have 10 layers, and each of them is gonna have this exact same random expression on there, how are you supposed to ensure that the random number for layer two is different from the random number for layer three? And the way it works is you have to give the random expression something to base the random number off of that is unique to each layer, okay. And so what I'm gonna do, and the command for this, if you ever forget it, come in here, Random Numbers, Seed Random, this is what you're gonna do. And there's two properties, okay? So the first one is the seed, so here's what we're gonna do, we'll change the word seed to index. When you're seeding the random number you want something that is unique to every instance of this random number, right, and so each layer has a different index. This is index two, the next one will be index three, and then four and then five, so that's gonna ensure that this random command gives us a different number for each layer. Now this is very important: timeless equals false. By default the random number will change on every single frame. You don't want that. If you type in true, that sets the timeless variable to true, meaning it picks one number and it sticks with that number. So now, there you go. Now this is offset by somewhere between negative 10 and 10 frames. So now if I duplicate this a whole buncha times, and we play it, there you go: randomness. Pretty awesome! And so lemme scrub forward here. Now here's one of the problems that you're gonna run into. Because I have this set to 10 frames, that means that some of these are gonna actually be set 10 frames before the master, and so even on frame zero you're already gonna see some of this animation. So you could mess with the expressions to fix that. I found it easier to just jump into your pre-comp and just knock this thing forward 10 frames. And the way I did that, if you don't know the hot key, you select the layer, you hold Shift Option, Shift Option, Page Up or Page Down, it will nudge your layer forward or backwards 10 frames. So now there you go. Now you've got complete randomness happening. But if you only wanted a little bit of randomness but you still wanted these to happen sort of in order, you can do it like that. And so now you can actually control both the sort of linear time offset and also the random time offset. And if you wanna stop watching right now that's the whole trick right there. The beauty of this is that I can take this Dot_MOGRAPH and put that in its own comp, and I could put a fill effect on there, and I actually used some of the tricks that I've used in other tutorials to get a nice little 3D look on that, and pick some nice colors for it, and so now I've got this. And what I can do, lemme call this FinalCOMP2, so if I duplicate Dot_MOGRAPH and I call this, I don't know, I'll show you how I did the cool circle, so this would be Circle_MOGRAPH, okay. And what I wanna do is take this dot, this little animation we made, and I'm gonna duplicate it and I'm gonna call it Circle. And let's go in here, and what I wanna do is, lemme duplicate this dot, and go to the beginning here, delete all these keyframes and scale it up to 100, and then I'm gonna change the Ellipse path to be pretty big. And I'm gonna get rid of the fill and I'm gonna turn the stroke up a little bit, and what I wanna do is make sure that this circle goes outside of where this little dot is landing, so I'm gonna crank this up a little bit like that, and now I'm gonna delete the dot. And then I can add a little trim paths here, right, and now I can just get like a little sweep like this. An so what I could do is I could animate maybe the Ellipse path size and I could also animate the offset of this, and maybe the ending too, so let's go forward 20 frames, and let's put keyframes on all those things we wanna keyframe, all right , and then we'll go back to the beginning and we'll animate the offset so it kinda moves around, and we'll animate the end, and why don't we also animate the start, too, right, so we can have it sort of start and kind of animate around and I'm gonna offset this a little bit, so you get kind of this, let's see, I don't really like what this is doin' yet, cool, so you've got this interesting little guy, and it's gonna end with a nice big chunk of a circle, there we go, cool. Sorry that took so long, I'm really anal when it comes to this kinda stuff. And then on top of that why don't we also animate the size? So it'll start out much smaller and maybe really crank up like that. I'm gonna really crank these bezier handles too. Cool, so you get something kinda interesting like that. Now what happens if you go into this Circle_MOGRAPH, select all these layers, and then you can just hold Option and just replace all of those with your circle. And then you can just duplicate the layers until you have enough to make the complete circle. If you didn't have enough in there you just duplicate, duplicate, duplicate, duplicate, duplicate. And there you go, now I have enough, and now I can go up to my control and say all right, I want nothing on the time offset, but I want a random offset of maybe eight frames. And if we go to the first frame, you'll see that you're still seeing some of the animation, so I need to go into my pre-comp and nudge this forward eight frames, and now you get this. Cool, right? And it's like, crazy looking! And it took no time at all to make. And I want it to happen faster, it's too slow, so I'm gonna get these closer together, there we go. Right? And then you just come to your final comp or Final_FOMP2 and you drag your Circle_MOGRAPH in there, and then you put a fill effect on there and you make it whatever color you want and what I did, also, is I would duplicate this and offset it and scale it down and, you know, just sort of start making repeating patterns, and what's cool is now you have this system in place where anything you make, you can just replace these layers and all the expressions will transfer over and you're done. And you can control all kinds of stuff, so if we look at some of the things I did, right, I created this animation, right, this triangle animates on, that's all it does. Just animates on and points that way. And so then if we go here, you can see that I have a random offset on them so they all end up doing that, and then in this comp I also added a scale, I keyframed the scale of them, so that when they came up, lemme make this a little bit bigger, when they animate on they then shrink down. So that was like a little extra layer of animation to it, but I also did things like these little lines, right? If we look at these, these are very simple. I animated one line, just doin' that, and I put it in my little Mograph setup and I did this. And in this case, this is one of those things where the offset not very much, you know. The offset here is half a frame, right? A half a frame! You can't do that in After Effects very easily, but if you set up the expressions, you can offset stuff by half a frame and get this really tight little spiral. So anyway, what I hope you guys take away from this aside from expressions are geeky, is that yes, expressions are geeky, but if you can just wrap your head around it a little bit, and at the very least, if you just know what's possible, and you know that you can go to schoolofmotion.com and copy and paste these expressions whenever you need to, just maybe buy me a beer if you ever meet me, you can do some super powerful crazy intricate stuff in After Effects without a ton of effort. You know, this whole demo here I probably put together in about 45 minutes because once you have the expressions set up, you can just keep makin' stuff, and just keep offsetting it and you know, there are much better designers out there than me that can probably do something amazing with this. So I hope you guys dug this, I hope, you know, this is just scratching the surface of what you can do, you really could do a whole bunch more really cool MoGraph-style stuff with expressions, but this is hopefully a good little intro for everybody. So thank you very much, these expressions will be available for copy/paste on the site, and I will see you next time. Thank you so much for watching. I hope this was interesting and I hope you learned something new about how to use expressions in After Effects, and just how powerful they can be. If you have any questions or thoughts about this lesson, definitely let us know, and we'd love to hear from you if you use this technique on a project, so give us a shout on Twitter @schoolofmotion and show us your work. Thank you again, and I'll see you on Day 29.
Info
Channel: School of Motion
Views: 52,243
Rating: undefined out of 5
Keywords: motion graphics, tutorial, Mograph, Effect, After Effects, Compositions
Id: X-rtjIGE6lQ
Channel Id: undefined
Length: 32min 59sec (1979 seconds)
Published: Wed Jun 28 2017
Related Videos
Note
Please note that this website is currently a work in progress! Lots of interesting data and statistics to come.