10 Replies Latest reply on Apr 8, 2013 3:03 PM by Rick Gerard

    Rescale precomp without changing stroke width used in precomp

    Leo Schelvis

      I'm trying to create a re-usable object which is a crosshair. I want it to show as below:

      Crosshair (0-00-01-16)_1.jpg

       

      When used in the composition I want to resize it, without changing border width and corner sizes. I made this possible by creating a shape layer and some expressions. However, when I'm using multiple crosshair in a single composition there is no good way to alter all crosshairs at once (I want them to show the same). That's why I created a precomp on which the box was sized to the composition size.

       

      In short: is there a way to create a single object (preferably a comp to be used in another comp) of which I can change the size without changing border width?

       

      Your help is greatly appreciated!

        • 1. Re: Rescale precomp without changing stroke width used in precomp
          Rick Gerard Adobe Community Professional & MVP

          If you used the rectangle shape tool you can change the size of the rectangle in the Components Rectangle Path without changing the width of the stroke.

           

          I'm curious about the expressions used. Maybe they were to match up the dashes and gaps with the rectangle size. Something like this:

          Screen Shot 2013-04-06 at 12.24.26 AM.png

          The first expression just divides the width of the square (rectangle) by eight to set the length of the stroke.

          The second expression simply subtracts that distance from the width of the square to set the gap.

          The third expression offsets the path by half of the length of the dash to center the dashes in the corners.

           

          You could also divide the width of the rectangle by say 10 for the dash and set the gap to the same as the dash and set the offset to half of the dash to keep the dashed lines evenly spaced around the rectangle.

           

          Then you could tie the size of rectangle 2 to the size of rectangle 1 and animate the size of rectangle one.

           

          If that's what you are doing then this should solve your problem You should be aware however, that as the dashes get shorter they will look wider even though they are not. They will also look thinner as they get longer even though they remain the same width. It's just the way our mind works. If there's a lot of change you might also want to tie the line width to the length of the dash by some kind of factor so that visually, the lines appear to stay the same size.

           

          Something like this should help hide the change:

           

          content("Rectangle 1").content("Stroke 1").dash.dash/Math.LN2/10

           

          Let me know if this solved your problem.

          • 2. Re: Rescale precomp without changing stroke width used in precomp
            Leo Schelvis Level 1

            Here you can find a screenshot of the different elements with all modified properties and expressions:

            Knipsel.PNG

            And this is the crosshair in action:

             

             

            I basically have two rectangles: one of 5 pixels and one of 9 pixels. The last one is for the corners and the first one for the rest of the box. The first two seconds the crosshair blinks and there is a sound synchronous with the flickering. I'm want to use multiple instances of the same crosshair in multiple sizes and would like to only change it in one place if I want to adjust the appereance besides the size (e.g. the flickering). When I'm resizing I need the border to stay the same thickness.

             

            That's why I tried to make a single composition to contain all elements. Is this the correct way or is there another way to solve it?

            • 3. Re: Rescale precomp without changing stroke width used in precomp
              Klaus_Brandenburg Level 2

              You should rather add a second stroke instead of another shape. Based on Ricks setup this would look like this:

               

              shapes.PNG

              In the Comp view you can see a downscaled copy wich has the same line thickness as the bigger one.

              1 person found this helpful
              • 4. Re: Rescale precomp without changing stroke width used in precomp
                Mylenium Most Valuable Participant

                Effects --> Channel --> Minimax

                Effects --> Matte --> Simple Choker

                 

                Simply Build the strokes twice or three times as thick in the big version, then use those effects to erode them to the planned thickness. Once you scale down, reduce the erosion effect to match the desired thickness. This might prove a lot simpler than trying to keep the shape layer logic straight, especially on multiple clones and without expressions...

                 

                Mylenium

                • 5. Re: Rescale precomp without changing stroke width used in precomp
                  Mylenium Most Valuable Participant

                  One more thought: You could use the Stroke layer style in a similar manner as the choking effects.

                   

                  Mylenium

                  • 6. Re: Rescale precomp without changing stroke width used in precomp
                    Rick Gerard Adobe Community Professional & MVP

                    I see what you're doing now. You've got a single shape layer with two rectangles. Expressions control the position of the corners and make the dashes crawl slowly using time as an offset multiplier.  You have tied the size of the rectangle to the size of the comp. This means that no matter what size the comp is your corners will stay the same size and the stroke for the box will stay the same.

                     

                    You also want to keep the audio in sync with the opacity keyframes.

                     

                    You want to be able to nest this comp inside another comp many times and scale the comp without changing the width of the stroke on the box or the size of the corners. To do that you will have to tie the scale of the nested comp to the stroke width of the stroke. This means you have to set up an expression for stroke width that references your main comp. The width of the box Did you follow that?

                     

                    Lets say the nested comp's name is Crosshair and the comp you want to nest it in is Main. Try setting up an expression for stroke width that references the main comp like this:

                     

                    compScale = comp("main").layer("crosshair").transform.scale/100;

                    value / compScale [0]

                     

                    This will keep the relationships right when the comp is nested. The only problem that you have in this workflow is that you'll need a duplicate of your Crosshair comp for each instance in the main comp and you'll need to change the expression in each duplicate to something like:

                     

                    compScale = comp("main").layer("crosshair2").transform.scale/100;

                    value / compScale [0]

                     

                    This would keep the audio in sync but it would require a lot of duplicate copies of the crosshair comp each with their own expression.

                     

                    An even simpler solution would be to add a slider to the CrossHair shape layer to control the size of the box and use that instead of comp size to control the size of the box. Now you could use duplicates of the crossHair shape layer instead of duplicates of a pre-comp. If you pre-compose your audio beeps you could then duplicate that pre-comp as many time as needed in your Main comp and slide the pre-comped audio to the in point of your shape layer.

                     

                    If you wanted to you could also add a layer marker to the Shape layer and have the marker control the start of the an opacity loop and sync a time remapped audio pre-comp to the opacity loop.  That way the timing of the opacity and the timing of the matching audio would be synced to the layer marker. There are lots of options here. Knowing a little more about your project would help a lot.

                    • 8. Re: Rescale precomp without changing stroke width used in precomp
                      Leo Schelvis Level 1

                      Rick, you are absolutely right. Thanks for the insights so far, I got it almost running. I created an pseudo effect to set all settings in one effect editor so I can easily duplicate the layer.

                       

                      The only thing I'm still working on is the sound. Could you eleborate on your remark:

                       

                       

                      Rick Gerard wrote:

                      If you wanted to you could also add a layer marker to the Shape layer and have the marker control the start of the an opacity loop and sync a time remapped audio pre-comp to the opacity loop.  That way the timing of the opacity and the timing of the matching audio would be synced to the layer marker. There are lots of options here. Knowing a little more about your project would help a lot.

                       

                      Is it possible this way to move the opacity keyframes and move the sound automatically?

                      • 9. Re: Rescale precomp without changing stroke width used in precomp
                        Klaus_Brandenburg Level 2

                        Check out this free preset from Aharon Rabinowitz: http://allbetsareoff.com/tutorials/spy-photo/

                        It has several effects as well as audio mapped on layer markers so you might find everything you need in there.

                         

                        update: and it works with markers

                        • 10. Re: Rescale precomp without changing stroke width used in precomp
                          Rick Gerard Adobe Community Professional & MVP

                          Markers are easier. You can set opacity and sound to start a loop at a marker. I'll have to think about using opacity keyframes.