9 Replies Latest reply on Mar 30, 2012 4:47 AM by nermie

    Help Required-Neon Light Effect

    nermie

      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-neon-light-sign-of-you r-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

        • 1. Re: Help Required-Neon Light Effect
          Rick Gerard Adobe Community Professional & MVP

          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
          
          • 2. Re: Help Required-Neon Light Effect
            nermie Level 1

            Thank You

             

            Worked a treat

            • 3. Re: Help Required-Neon Light Effect
              Rick Gerard Adobe Community Professional & MVP

              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.

              • 4. Re: Help Required-Neon Light Effect
                nermie Level 1

                Thanks,

                 

                I will store this one for later.

                 

                First task will be to finish off implementing the Tutorial.

                • 5. Re: Help Required-Neon Light Effect
                  nermie Level 1

                  Rick,

                   

                  Now looking for help to control an audio layer. I want to be able to turn on

                  and off an audio layer in time with the light (controlled by ³Checkbox²)

                   

                  Not sure how to do this.

                   

                  Ta

                  • 6. Re: Help Required-Neon Light Effect
                    Rick Gerard Adobe Community Professional & MVP

                    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?

                    • 7. Re: Help Required-Neon Light Effect
                      nermie Level 1

                      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");

                       

                      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

                      • 8. Re: Help Required-Neon Light Effect
                        Rick Gerard Adobe Community Professional & MVP

                        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.

                        • 9. Re: Help Required-Neon Light Effect
                          nermie Level 1

                          Thank You,

                           

                          That worked,

                           

                          Used bottom solution, renamed ³Checkbox Control² to ³TurnsOnOff², which was

                          name of checkbox and used variables of 4 and 48.

                           

                          Thanks again.

                           

                          Project completed now and is working as planned.

                           

                          May need to tweak a few variables and timings, but looking OK as is.