Creating Bulb Fluctuation Using Expressions in After Effects

In this tutorial I'll show you how to make an effect of bulb fluctuation in After Effects using simple expressions. You can then control the fluctuation manually or automatically.
Preview
1. Creating Elements in Photoshop
Step 1
Open Photoshop.



Step 2
Press Ctrl-N to create a new composition. Set the Width and Height of the
document as 1280 and 720 respectively.



Step 3
I have a bulb image which I import in the composition. Rename this layer as
Bulb.



Step 4
With the Bulb layer selected, press Ctrl-J key to make a
duplicate layer of it.



Step 5
Rename the copied layer as Bulb Glass.



Step 6
Turn off the visibility of Bulb layer. With the help of Eraser
tool, erase the bottom part of the bulb in the Bulb Glass layer.



Step 7
Turn on the visibility of the Bulb layer.



Step 8
Press Shift-Ctrl-N to create a new layer. Rename this layer as Slider.



Step 9
Make a shape of slider in the Slider layer as shown in the following
image.



Step 10
Following the same way, create a new layer and rename it as Slider
Button. Create a button like shape in this layer as shown in the following
image.



Step 11
Press Shift-Ctrl-N to create a new layer. Rename this layer as Filament.



Step 12
With the help of Brush tool, paint the filament with the white color.



Step 13
Save the file as Bulb.PSD.



2. Compositing in After Effects
Step 1
Open After Effects.



Step 2
Press Ctrl-I key to open the Import Files window. Select the
saved Bulb.PSD file and click on the Open button.



Step 3
A small option window appears. Select Import Kind as Composition
and then click on OK.



Step 4
All elements of the Bulb.PSD layer get imported as Bulb
composition. Double click on the Bulb comp in the project window. You
get all layers on the timeline.



Step 5
Make an elliptical mask on the Background layer. Increase the
feather amount of the mask to make the corners a bit dark.



Step 6
With the Bulb Glass layer selected, go to Effects > Generate >
Fill and apply the effect.



Step 7
Choose a very light yellow color as the fill color. The bulb’s glass adapts
the color accordingly.



Step 8
With the Bulb Glass layer selected, go to Effects > Sapphire
Lighting > S_Glow and apply the effect. Increase the Glow Width
amount to 120 and Brightness amount to 2.



Step 9
Follow the same process with the Filament layer also. With the Filament
layer selected, go to Effects > Sapphire Lighting > S_Glow and
apply the effect. Increase the Glow Width amount to 36 and Brightness
amount to 5.



Step 10
With the Filament layer selected and Alt key pressed, click on the stop watch of Brightness property. It opens the expression editor. Here write the following code:
1 |
y= thisComp.layer("Slider Button").transform.position[1]; |
2 |
|
3 |
yMin = 420; |
4 |
|
5 |
yMax = 445; |
6 |
|
7 |
linear(y,yMin,yMax,5,0) |



Step 11
Follow the same procedure for the Opacity value of the Filament layer. With the Alt key pressed, click on the stop watch of Opacity property. It opens the expression editor. Here enter the following code:
1 |
y= thisComp.layer("Slider Button").transform.position[1]; |
2 |
|
3 |
yMin = 420; |
4 |
|
5 |
yMax = 445; |
6 |
|
7 |
linear(y,yMin,yMax,100,0) |



Step 12
Follow the same procedure for the Opacity value of the Bulb Glass layer. With the Alt key pressed, click on the stop watch of Opacity property. It opens the expression editor. Here enter the following code:
1 |
y= thisComp.layer("Slider Button").transform.position[1]; |
2 |
|
3 |
yMin = 130; |
4 |
|
5 |
yMax = 445; |
6 |
|
7 |
linear(y,yMin,yMax,100,0) |



Step 13
If you want automatic fluctuation, then with the Alt key pressed, click on the stop watch of Position property of the Slider Button layer. It opens the expression editor. Here enter the following code:
1 |
x = transform.position[0]; |
2 |
|
3 |
y = transform.position[1]; |
4 |
|
5 |
w = wiggle(6, 210); |
6 |
|
7 |
[x, w[1]]; |



Step 14
Move the Y position of the Slider Button layer. The intensity of the filament and the glow of the bulb can be controlled with the movement of the slider button in Y direction.
Keep playing with the
values of the yMin and yMax to get different types of results.



Conclusion
Although some knowledge of mathematics and scripting is required, though you can do amazing and complex works easily with the help of expressions as it saves your a lot of time.
Keep watching this space as I will come up with some more tutorials based on expressions.