Skip navigation
Currently Being Moderated

Help Required-Neon Light Effect

Mar 27, 2012 12:40 AM

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

 
Replies
  • Currently Being Moderated
    Mar 27, 2012 1:52 AM   in reply to nermie

    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
    
     
    |
    Mark as:
  • Currently Being Moderated
    Mar 27, 2012 3:07 AM   in reply to nermie

    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.

     
    |
    Mark as:
  • Currently Being Moderated
    Mar 29, 2012 1:29 AM   in reply to nermie

    Just apply the expression to audio levels but change the values. 0 is audio on with no adjustments from the original recording. Minus 48 (-48) is off.

     

    Does that make sense?

     
    |
    Mark as:
  • Currently Being Moderated
    Mar 30, 2012 3:18 AM   in reply to nermie

    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.

     
    |
    Mark as:

More Like This

  • Retrieving data ...

Bookmarked By (0)

Answers + Points = Status

  • 10 points awarded for Correct Answers
  • 5 points awarded for Helpful Answers
  • 10,000+ points
  • 1,001-10,000 points
  • 501-1,000 points
  • 5-500 points