7 Replies Latest reply on Nov 23, 2010 11:07 AM by Andy Bay

    Bulge effect center to follow a rotated layer

    Andy Bay Level 1

      Hey guys!

       

      This one got me bad I've been thinking my brains out but just can't seem to find a proper solution:

       

      Imagine a light bulb hanging from the ceiling. The wire that it's hanging from is rotating and the light bulb is parented to that wire, so that it follows the rotations. In other words the light bulb is swinging back and forth. I simply want the bulge effect to follow where the light bulb goes, but man is that turning out to be a difficult task!

       

      It's difficult, because the bulge effect can only be moved by changing the "bulge center" parameter. If I for example put the bulge effect on an adjustment layer and rotate/move the adjustment layer, nothing happens, since the bulge center itself is not moved.

       

      How on earth can I get the bulge center to follow a rotation that exists on a parent layer, so that also the anchor point of that bulge center rotation is placed where it should be (the same place where the anchor point for the wire is)? The anchor point is important to make the bulge center always be where the light bulb is, to give the illusion of the light bulb glass "bulging" the wall behind it.

       

      Wow am I in awe if someone can come up with an elegant solution!

        • 1. Re: Bulge effect center to follow a rotated layer
          Mylenium Most Valuable Participant

          Depends on how you create the wire, I guess.... Simple pickwhip expressions would do the trick when using the Beam effect, for everything else we need more info on the specific setup...

           

          Mylenium

          • 2. Re: Bulge effect center to follow a rotated layer
            Andy Bay Level 1

            Hi!

             

            I attached an image of the situation!

             

            The wire is simply a image file that is rotating. And the lamp is parented to the wire, thus it follows the rotation.

             

            Thank you!

             

            bulge-problem.jpg

            • 3. Re: Bulge effect center to follow a rotated layer
              Mylenium Most Valuable Participant

              This is what you need: http://www.motionscript.com/mastering-expressions/lst-lens-flare.html Apply a Point expression control on your light bulb layer where you want the center of the bulge, then apply the expression to the comp. The only difference to Dan's tute is that you would reference the point control, not the anchor point or a default value. Should look something like that:

              bulb=thisComp.layer("Lightbulb");
              bulbCenter=bulb.effect("Center")("Point");
              
              bulb.toComp(bulbCenter)
              

               

              Mylenium

              1 person found this helpful
              • 4. Re: Bulge effect center to follow a rotated layer
                Rick Gerard Adobe Community Professional & MVP

                If you want the Bulge applied to the light bulb layer you can just apply it. No expression necessary.

                 

                If you want to apply Bulge to an adjustment layer then you need to do a few things. First, as you have done, parent the Bulb to the Cord. Then move the anchor point of the Bulb layer to where you want the center of the bulge to be. Now add the following expression to the Bulge Center property on the adjustment layer:

                bulb = thisComp.layer("Bulb");
                cntr = bulb.anchorPoint;
                bulb.toComp(cntr)
                
                

                Here's a CS5 sample comp.

                • 5. Re: Bulge effect center to follow a rotated layer
                  Andy Bay Level 1

                  Thank you both very much!

                   

                  I tested so far only Rick's way, but it worked very nicely!

                   

                  bulb = thisComp.layer("Bulb");
                  cntr = bulb.anchorPoint;

                  bulb.toComp(cntr)

                   

                  Can you open up this expression a little? I understand that first you claim the variable "bulb" to refer to a layer called "Bulb" inside the current composition. Then a variable "cntr" is created, but what exactly does that variable do? I also don't undertand the final statement bulb.toComp(cntr) what is that actually telling the bulge center property to do?

                  • 6. Re: Bulge effect center to follow a rotated layer
                    Rick Gerard Adobe Community Professional & MVP

                    bulb = thisComp.layer("Bulb");
                    cntr = bulb.anchorPoint;

                    bulb.toComp(cntr)

                    bulb is referring to the footage layer named Bulb

                     

                    cntr could be anything. This is just a cleaner way to write thisComp.layer("Bulb".anchorPoint") and it makes writing the layer space transformation easier.

                     

                    You could write:

                     

                    thisComp.layer("Bulb").toComp(thisComp.layer("Bulb").anchorPoint)

                     

                    I think that is a lot more difficult to understand and it's more difficult to write. The expression simply returns the composition coordinates of the "Bulb" layer's anchor point. IOW For the layer "Bulb" (bulb.) give me the Composition Coordinates of the Anchor Point (toComp (cntr).

                     

                    When you attach a parent to a layer the position property values are calculated as an offset from the parent layer's position property. Layer Space transformations recalculate the  position in relative to the composition or to the world when working with 3D layers.

                     

                    Here's how the expressions works in plain english.

                    Calculate the position coordinates by calculating the offset of the target layer from the composition center by calculating the difference between the child layer's (Bulb) position coordinates from the parent layers (Cord Layer) position offset from the composition center to determine the actual composition coordinates of the child layer's anchor point.

                     

                    There's more info about layer space transformations in the expressions section of the help files. It's worth reading.

                    1 person found this helpful
                    • 7. Re: Bulge effect center to follow a rotated layer
                      Andy Bay Level 1

                      Thank you very much, that is one helpfull expression!