Hi,
I am trying to follow a tutorial on how to create a animated neon light using after effects.
The tutorial is at http://ae.tutsplus.com/tutorials/motion-graphics/simulate-a-glowing-ne on-light-sign-of-your-logo-2/
I get stuck at the part of the tutorial (around 11 min mark) which establishes the check box to turn on and off opacity. I think I have faithfully followed the tut with an expression against opacity but the check box does not work,
The code I have used is as below
OF=thisComp.layer(“Controls”).effect(“TurnsOnOff”)(“Checkbox”);
if (OF==0)
0
else (OF==1)
100
Can anyone help as I ma stuck at this point and would like to continua as the effect is what I am looking for.
Ta
You don't need the else (OF==1). That's what breaks the expression. It's the wrong way to use an else statement. You could use another if argument.
I'd write the expression this way because it gives you the option of animating the opacity or the layer or easily setting it to a a different value. In this case I picked a better name for the checkbox variable too. You should try to use names that more accurately describe what the variable is doing. You can never go wrong using a name minus vowel.
chkBx = thisComp.layer("Controls").effect("Checkbox Control")("Checkbox");
if (chkBx == 0) {
0}
else value
A better solution may be to add some randomness to the opacity and a marker to turn the effect off completely. This would let you set fewer keyframes.
Try this one:
mrkrOff = thisLayer.marker.key(1).time;
sw = thisComp.layer("Controls").effect("Checkbox Control")("Checkbox");
if (time<mrkrOff && sw == 0) {
t = random (40, 70)};
else if (time<mrkrOff && sw == 1) {
t = 100};
else t = 0;
The expression is simply defining a variable markerOff as the time value for the marker on the current layer (thisLayer.marker.key(1).time = time value for the first marker on the layer).
The if statement says if the time is less than the time of the marker and the switch is off then make the opacity (t) a random value between 40 and 70, or if the time is less than the marker time and the switch is on (1) then set the opacity to 100, but if the time is greater than the marker set the opacity to zero.
Hope this helps.
Rick,
It doesn¹t like that expression.
By default when linked to the checkbox it puts in the following expression
temp = thisComp.layer("Controls").effect("TurnsOnOff")("Checkbox");
Re: Help Required-Neon Light Effect
When I cut and paste the previous expression you gave me and inserted
values of 0 and 48, it gave me an error message about expression result
must be of dimension 2, not 1
The only dimension I can see is output level, I thought this might be a
stereo Left and Right channel, thing so I tried 0,0 and 48,-48 but this
didn¹t work either.
Any ideas
Yes, stereo audio is two dimensions. You didn't create the array for the two values because you left off the square brackets. Try this:
chkBx = thisComp.layer("Controls").effect("Checkbox Control")("Checkbox");
if (chkBx == 0) {
[0, 0]}
else [-48, -48]
or a better solution may be to define a variable in the if statement and write the expression this way:
chkBx = thisComp.layer("Controls").effect("Checkbox Control")("Checkbox");
if (chkBx == 0) {
alvl = 0}
else alvl = -4;
[alvl, alvl]
You could switch left and right chanels by writing the expression this way:
chkBx = thisComp.layer("Controls").effect("Checkbox Control")("Checkbox");
if (chkBx == 0) {
[-48, 0]}
else [0, -48]
Hope this helps.
North America
Europe, Middle East and Africa
Asia Pacific