Animate a Flickering Light with Expressions
in this lesson, we're going to recreate this flickering light bulb effect using the wiggle expression that you've used before. So you can follow along with the flickering light after effects project or build it from scratch using the lightbulb jpeg image. So the first thing you want to do is create a new composition. I'll just call this light bulb two 1920 by 10 85 seconds. You know the drill by now and then bring in our light bulb. I'm just going to decrease the size and put it more in the center. Like so, so when you think about a flickering light bulb, what's actually happening? Well, the filament inside the light bulb is flickering on and off. And so that's what we're going to have to really intensify or turn on and off or add some sort of effect to make it look like that. Also, what's happening at the same time is the image or the view the room or wherever you are in that with that light bulb is getting brighter and darker. So the first thing we wanna do is separate this filament ...
so that we can apply an effect to it. So let's duplicate our light bulb layer And then turn off our background one and we're just going to be working with this filament. So let's just take our elipse tool and draw, whoops with our light bulb layers selected. Draw around our filament, press f to add a little bit of feathering so that whatever we do blends in with the background and I'm going to rename this to be glow. Okay, so there's one effect that we haven't used before called lou mckee that I want you to apply to this layer. So type in lieu. MMA. And it's actually under the obsolete folder which is means it's an older effect. That might not be with future versions of after effects, but for now I'm still going to use it. Um if you don't have access to this, just skip this part and it's going to be fine. So once I apply this to this layer up in our effects controls, you see the luma key effect which is similar to the key light effect that we use to get rid of all the green screen background. But the lumia ki actually keys out instead of color by color. It keys out by brightness so you can key out darker or key out brighter. We want to keep out the darker because we want to keep out everything except for this bright filament within this light bulb. So let's crank up our threshold until everything disappears except for really just our filament. So that looks pretty good. And then we can play with the edge thin and the feathering to add a little bit of feathering this, we can increase or decrease the edge thin. If we want to add a little bit more, we'll add just a little bit more like that. Crank up our threshold a little bit to get rid of any of those spots and that looks great. So if we turn on our background image and then turn on and off our glow, nothing happens because it's just the same image. We have to apply another effect to this filament to make it look good. So typing glow and apply the glow effect under stylist to this layer. You can drop it on the layer or drop it in the effects controls window as soon as you we do that you see that there's this glow applied and it's pretty darn bright. We can play around with how this affects this film it with things like the threshold, the radius and the intensity. So if I bring up the radius It's like 50 or so or even even more. What happens is it spreads out the glow, which I think looks a little bit more natural. The glow intensity. If we drop this down to zero It means nothing is happening. And then if we bring it back up to one It means that it has whatever one pixel or one point is for the glow intensity it increases a lot with glow intensity. This is what we're going to be adjusting with our expression and it has the stopwatch icon so we can add expressions to it. So if we option click that stopwatch, we see that we have our text box down here and what we can type in is wiggle then we have to decide every what four times a second we wanted to adjust by points, parentheses semicolon and let's just click off. So if we play through this, let me turn down our quality so we can play through a little quicker. We see that it turns on the glow, it's it's probably a little too bright And it doesn't really flicker that fast. So I think we need to increase the speed of this flicker. So let's go in here, let's do times a second, Maybe five instead of 10, adjusting by 10. That looks pretty good. I think that's more of a flicker maybe even a little faster. So let's do 15 and maybe a little tiny bit less too, that's really flickering on and off, which I think looks pretty good. So that looks good. But the other thing with our light is that if this is flickering on and off, like this, we need the whole composition to flicker on and off. And we're going to do that with a new tool that we haven't used called lights. So if you go up to layer, then new, then click light. It opens up the light settings and we can call this light one. We want to make sure it's on spotlight, you have different lights but typically I'm going to use spot and ambient lights and this is think of it as like a spotlight, you can shine it on a specific part of your composition. Leave all of these settings the same. We can adjust them later and you'll be able to see what it's actually doing then and then click Ok now nothing happens. And that's because lights only affect three D layers. So let's enable the three D layer for both of these layers glow and light bulb. And when we do that you can see what the light bulb is doing. If we turn this on and off, you get this sort of spotlight effect and within lights you can make all kinds of changes under the light options you have like the intensity, you have the cone angle which will make it wider or smaller, the feathering which will increase the feathering or decrease the feathering of that cone all kinds of things. And then under transform you can adjust how this is positioned. So you can adjust the position of the light itself further or closer to your composition. Up or down. You can put the light up or down at the bottom and then you can also change the point of interest. So this is actually changing where the light is but where it's shining is the point of interest. So I can put this down like so which I think is pretty cool. So we put the light up and then we drop the point of interest so it looks like you know it's a light shining down which I think makes sense. Now with the light options it's the intensity that we're going to add the wiggle expression too, because we want this to go on and off. So if we go down to glow and we find our wiggle expression which is wiggle 15 comma two and copy this and paste this to the intensity by option clicking the stop, watch for intensity and pasting it. What happens is not much and that's because the intensity of this light isn't changing much, it's only changing by two points. And so since this is a range of one, it's not gonna work. So what if we wanted to be 100? So it flickers on and off? Well, that's good. That's more like what we're doing. But there's another problem while this is flickering on and off at the same rate as the filament inside. It's not doing it at the same time. Sometimes when the filament is bright, the light is dark or when the filament is dark, the light is, the light itself is bright and we want it to happen at the exact same time. We can do that by tying this part of this effect. The intensity to the intensity of the glow. How do you think we're going to do that? Similar to parenting when you add an expression, there's this pick whip tool right here. So let me open this up just a little bit. So we see both the glow intensity down here and the intensity of the light here. If I first, let's delete the wiggle and then let's option click intensity and drag the pick, pick whip of the intensity of the light to the glow intensity. What's going to happen is, well, it's going to go with the intensity of the light, but again, it's not that much because it's only by 2% points because it's right here. So with expressions we can do a little math, you can do subtraction addition, multiplication division. So we could say, oh well this is affecting by two. So maybe we just want to do plus 90 But that's not going to look that good because it's only staying at 90 and then 90-90, So we want to do a multiplication. So let's delete that plus 90. And for multiplication, you use the asterisk and that's the multiplication sign in after effects. And so let's do times and then let's do a semicolon, click off. So now it is increasing or decreasing the light intensity at the same time as this Glow intensity and multiplying it by 50. So see you can do a lot of stuff with the after effects expressions, which is pretty cool. But there's one other thing I don't like about this and that's that when the light is completely off, I still want to be able to see are seen a little bit. I don't want it to be completely dark, like right here. So we can add another light bulb. So let me go here where it's like completely off somewhere right there. Okay, and let's add a layer new light and for this one, let's add an ambient light. Leave the settings as it is now. And click Ok, now what happens is this ambient light, it adds to the other light. So when you're adding multiple lights together, they kind of multiply the effect. So you have to be careful because it could get too bright, it could get overexposed, like I think that's a little too overexposed. So let's go to that point where it was dark. So let's turn off the ambient light. So this is where it's dark, Turn on the ambient light and then drop the intensity of the ambient light to where it's more natural. Something like that. That looks good. Okay, so that looks pretty darn good. So that's our flickering light, which I think looks pretty good already. There's one thing that also bugs me a little bit and that is the fact that when this filament is off, when the intensity is not high, you still see the filament of the background. So the filament of this background is always happening, which I don't like. So what we can do is actually use another tool that we haven't used the clone tool. So let's go to the start of our composition, click on this clone stamp tool and then double click our light bulb and that takes us into the layer settings, we can zoom in here and if you've used the clone stamp tool in Photoshop this is going to make a lot of sense If you haven't, when you click on the clone stamp tool, you can change the size by pressing command and dragging to the right or left clicking and dragging. And then what you need to do is tell after effects. What do you want to stamp and you do that by option clicking. So if I hold option down, you have this little target and that's the selection I'm going to make. So I want to make a selection around this light bulb. So click option click. And then if I take my regular brush without the option button and then drag over. Then we get it's copying what I selected over here. Now just for example if I option, click over here, then paste over here, it's copying what I pasted over here. The other thing to note is that say I pick something on the edge closer like option click there and then I drag and then I keep dragging. Well what's going to happen is it's just going to copy this area over to the left so it's copying the edge of the light bulb which I don't want. So you might have to just option and then click and drag and then do it a couple of times. See what I'm doing. I'm just option clicking and pasting over, option clicking pasting over, option clicking pasting over little by little until it looks a little bit more natural. Now, since this is a still image, it works fine and it's going to stay the same throughout the entire video. If it's a video clip, the clone stamp tool only applies to that frame. So just be aware of that. Now if I go back to my composition, this is what it looked like with it off. And now if we turn everything back on, we can see that when the filament intensity is lower, it looks a little bit more natural. The background is a little bit more natural. What we could even do is add a sort of black filament. So if we duplicate the glow layer and then put this down below. Call this filament. I don't even know if that's how you spell it. I think it's maybe fill mint, correct me if I'm wrong and then delete our glow and then instead of our glow effect at a Phil so generate fill effect, drag that on there and then change it to be black. Okay, so now you don't see anything but let's turn off our glow layer. So now you see that this is just black and let's thin the edges quite a bit. So something like that and maybe we don't want it to be completely black, let's change the color, something like that. Maybe something a little bit more natural. Like a dark brown. Okay, so that's our light bulb off and then we add our glow. So when the glow goes down you can kind of see those filaments down in the background. Cool. So now we have our light bulb all set up. Looks more proper. The last thing I'm going to do is add a camera move so layer. New camera, click. Ok. And then later new null object. Because I always like my null objects and parenting my camera to the null object, which I'm going to make a three D. Layer and then I'm just gonna do a subtle push in. So I'm going to click here, set a key frame then go forward and drag to the right to push in and put that key frame at the very end and now we have our moving composition with this flickering light. The cool thing now is that if we think oh man it's going too fast, it's going to intense. What we can do is go into our glow settings and change the wiggle setting. Say it's going too fast and maybe it's too intense. Let's just make this one so 10 1. This is cool because it adjusts both the glow itself and it affects the light automatically because the light is parented to this, the only thing we might have to do now is adjust the ambient light itself or if again if it's not enough we might have to multiply this by something a little bit brighter, but I think this looks pretty good. Maybe increase the ambient light to like 60 or something like that. And I think that looks pretty darn cool. So now you know how to use expressions, You know how you can parent different properties to expressions to match the animation to that other expression. Now, what I'm going to do is I'm going to link to some other resources and tutorials that I think will really help you with using expressions and taking it to the next level because once you start using expressions, you know, it's a you're becoming a more advanced user, which I applaud you. But for this course, I really just wanted to help you understand how you apply expressions and understand what they are and hopefully have done that so far. Thank you so much for watching this lecture and we'll see you in another one.