22 Replies Latest reply on Mar 27, 2017 5:39 AM by rob day

    InDesign what determines where the different colours of a gradient swatch begins?

    Andreas Jansson Level 2

      Sometimes when I apply another swatch (to see what it looks like) and then switch back to the original gradient swatch, the starting positions of the lines or circles are moved. Just unchecking and checking the preview checkbox has the same effect.

       

      Howcome? Is the position where the gradient "begins" recalculated, and if so, why is the result different from before?

       

      The two circles below are the same size and have the same gradient swatch applied as stroke, but the yellow colour (right-most in the "gradient ramp") is just barely visible on the left circle. Why are they not affected in the same way?

      If I select the left circle and reapply the swatch it becomes the same as the right one.

      Capture.JPG

        • 1. Re: InDesign what determines where the different colours of a gradient swatch begins?
          Willi Adelberger Most Valuable Participant

          The left circle is determined how it was applied to the object with the gradient. But it is not the very same as the open swatch.

          The transition is also determined by the small diamond indicator above the ramp bar.

          • 2. Re: InDesign what determines where the different colours of a gradient swatch begins?
            rob day Adobe Community Professional & MVP

            If you apply a radial gradient swatch to a stroke of a circle, it looks to me like the gradient is calculated from the center of the circle and not the width of the stroke. Also the position of the stroke (inside, center, outside) matters. Here I have a 100pt diameter circle with a 99pt stroke and when I change it to 10pt you can see what happens:

             

            Screen Shot 2017-03-24 at 8.28.57 AM.pngScreen Shot 2017-03-24 at 8.29.46 AM.png

             

            But it doesn't seem like you really are trying to get a gradation, but want multiple solid strokes. Why not simply nest different sized circles where you can spec the dimension and color of each stroke and then group the circles?

            • 3. Re: InDesign what determines where the different colours of a gradient swatch begins?
              Andreas Jansson Level 2

              How can I see what has been altered, or if there is a change at all? On style there are "+" characters that indicate overridden attributes. Can I detect a similar thing on my circles?

               

              You can observe the same thing as my example in this sample: Tips & Techniques: Create stripes in InDesign

              (download the sample file from the link in the text). Just open the file, select the right rectancle, and you will see that the swatch "Stripes radial" will get selected in the Swatches palette. Right click it and select "Swatch options". (Uncheck and) check the "Preview" box, and the circles will change in the rectangle.

               

              Capture.JPG

               

               

              I appreciate your answers, both Rob and Willi, but there must be something I don't understand.

              • 4. Re: InDesign what determines where the different colours of a gradient swatch begins?
                rob day Adobe Community Professional & MVP

                The gradient example is using fills not strokes. I don't think the trick can work reliably when the gradient is applied to a stroke—unless maybe the stroke was always the same thickness, set to inside, and the circle was always the same dimension.

                • 5. Re: InDesign what determines where the different colours of a gradient swatch begins?
                  rob day Adobe Community Professional & MVP

                  You can see what happens if the ellipse is not a circle—the gradient radiates from the center point:

                   

                  Screen Shot 2017-03-24 at 10.22.43 AM.png

                  • 6. Re: InDesign what determines where the different colours of a gradient swatch begins?
                    Andreas Jansson Level 2

                    Well, the effect that I'm asking about seems to be the same in the downloaded "fill" example. The "origin" of the lines or circles changes when I select an object and enter the properties of the applied gradient swatch (and just turn on preview).

                     

                    On the external sample I just noticed that the changes made to the fills must be that they have manually set origins and "lengths" (I don't know the correct terms) for the gradients. Using the gradient tool I can restore the looks of the original fill that was obviously reset when I reapplied the swatch (or just watched the looks of it being reapplied using the preview option).

                     

                    I never used the gradient tool on my own circles though, so there it must be some other change that I've made that has affected the origin or range of the gradient stroke.

                    • 7. Re: InDesign what determines where the different colours of a gradient swatch begins?
                      Laubender Adobe Community Professional & MVP

                      Hi Andreas,

                       

                      you must be aware that on one hand we have the gradient like you see it in the Swatches panel.
                      On the other hand there is the graphic frame where the gradient is applied to.

                       

                      Trivial?

                       

                      Not, if you consider the following:

                      The look of the applied gradient is shaped by a triple of properties of the graphic frame.
                      Not of the gradient.

                       

                      Three properties that come along with the fill and three that come along with the stroke of a graphic frame.

                       

                      Setting e.g. the fill to "none" will not reset the values for that three properties.
                      EDIT: Setting the fill to a non-gradient swatch will not reset the values either.

                       

                      The three values are:

                       

                      gradientFillAngle will define the angle of a linear gradient
                      gradientFillLength will span the 0% to100% of your gradient stops.
                      gradientFillStart will define the start of an applied gradient in x/y values

                       

                      With the Gradient Tool one can manipulate the three properties.
                      Depending on the type of a gradient—linear or radial—the three properties may react differently.

                       

                      The same properties do exist for strokes:

                       

                      gradientStrokeAngle

                      gradientStrokeLength

                      gradientStrokeStart

                       

                      And what makes this case more complex is:

                      1. We also have to consider, if some scaling, rotation or shear transformations are applied to the graphic frame.

                      2. Changing the size of a graphic frame will not change the values for the three properties.
                      And by changing the size I do not mean scaling. Rotation and shear will not change the size.

                       

                      What has all this to do with your problems?

                      Maybe you resized a circle and then applied a new gradient?
                      Or you changed the shape of a rectangle to a circle where you once applied a gradient, changed the defaults using the Gradient tool, applied fill color "None" and forgot about it?

                       

                      If you want to make sure that a specific "look" is applied by using a gradient, make sure that you start from scratch with a new graphic frame. Otherwise you cannot be absolutely sure, that one of the three properties will not start at their default values.

                       

                      Regards,
                      Uwe

                      • 8. Re: InDesign what determines where the different colours of a gradient swatch begins?
                        rob day Adobe Community Professional & MVP

                        Uwe, I maybe wrong, but I think when Andreas applies a gradient to a stroke he is expecting the gradient to follow the contours of the stroked path. In the case of a circle stroked with a radial blend it can appear that's what is happening, but non-uniform shapes shows that's not the case.

                        Screen Shot 2017-03-24 at 12.52.50 PM.png

                         

                         

                        If the task is to create multiple stoked circles, which can be updated later, that could easily be accomplished via Object styles or an Internally Linked object.

                         

                        Use linked content features in InDesign

                        • 9. Re: InDesign what determines where the different colours of a gradient swatch begins?
                          Laubender Adobe Community Professional & MVP

                          Tried to edit my reply above. But Jive did not let me. Claimed, that I am signed out. Apparently I'm not!

                           

                          Here my edits:

                          Setting e.g. the fill to "none" will not reset the values for that three properties.

                          EDIT: Setting the fill to a non-gradient swatch will not reset the values either.

                           

                          The second statement is not true. Setting a "normal" swatch as fill color can reset the three properties.

                          Another thing one has to be aware ;-)

                           

                          Regards,
                          Uwe

                          • 10. Re: InDesign what determines where the different colours of a gradient swatch begins?
                            Andreas Jansson Level 2

                            Great answer!

                            Good to know that this was not a trivial thing.

                            Starting from scratch when experimenting with new looks was a good idea.

                             

                            I just discovered what I probably did change to my circles after applying the swatch to them: the stroke width.

                             

                            I could repeat the behaviour from scratch now:

                            I applied the gradient swatch to a circle with a thin stroke (e.g. 1 mm)

                            I changed the stroke width to 10 mm

                            Entering the properties of the swatch and unchecking/checking the preview, I see the effect that I've been asking about. So the stroke width is somehow also affecting the appearance of the gradient.

                             

                            Perhaps it's affecting one of the three properties that you wrote about Uwe, otherwise its another parameter to take into account, adding to the complexity. Anyway it's nice to know what it that was causing this effect, and also to learn more about the gradient swatches, which I've never used before.

                             

                            Uwe: your edited answer made much more sense to me, since that was what I thought I saw happening.

                            • 11. Re: InDesign what determines where the different colours of a gradient swatch begins?
                              Laubender Adobe Community Professional & MVP

                              Hm…
                              The stroke width.


                              How is your definition of the preferences with scaling?
                              And what options are checked with your Transformation panel for strokes?

                               

                              Regards,
                              Uwe

                              • 12. Re: InDesign what determines where the different colours of a gradient swatch begins?
                                Andreas Jansson Level 2

                                I just expected circles and lines from the swatch. My concern was that the applied look in the document was changing (or rather reset) when I just opened the properties of the swatch and unchecked / checked the preview checkbox. The same thing happens when applying another swatch (stroke or fill) and then returning to the previous one. I think it all boils down to properties being reset.

                                 

                                Stroke width (changed after applying the swatch for the first time) was causing this mystery for me.

                                • 13. Re: InDesign what determines where the different colours of a gradient swatch begins?
                                  Andreas Jansson Level 2

                                  >How is your definition of the preferences with scaling?

                                  >And what options are checked with your Transformation panel for strokes?

                                   

                                  I'm not sure what panels these are, that you are asking for. You will have to guide me (screen shots or where I should look for them).

                                  I did no other changes than the steps I described above. Stroke width was what made this appear...

                                  • 14. Re: InDesign what determines where the different colours of a gradient swatch begins?
                                    Laubender Adobe Community Professional & MVP

                                    Ok.
                                    I mean the preferences for scaling in the General tab of the InDesign preferences .

                                    Two different choices here:

                                     

                                    WhenScalingOptions.APPLY_TO_CONTENT

                                    WhenScalingOptions.ADJUST_SCALING_PERCENTAGE

                                     

                                    Did not test, if one or the other option will change the behavior of the applied gradient fill if stroke size will change.
                                    And the Transform panel can be found under Window > Objects and Layout > Transform

                                    I'm using a German InDesign so I'm not exactly sure about the English terms.

                                     

                                    Sorry. But I have to leave now for the evening…
                                    Will be back tomorrow.

                                     

                                    Best,

                                    Uwe

                                    • 15. Re: InDesign what determines where the different colours of a gradient swatch begins?
                                      rob day Adobe Community Professional & MVP

                                      Uwe, it looks to me like the default for applying a stroke gradient to a newly created object is: the gradient stroke start centered on the selection, and the gradient stroke length is half the object's width. Of course if you use the Gradient Tool on the selection the start, length, and angle could be anything.

                                       

                                      This approach for applying multiple strokes seems overly difficult and I wouldn't want to spend too much time on it, but we should be able to reset an object's defaults via a script. This seems to work:

                                       

                                      -----------------------------------------------------------------

                                      --resets the stroke gradient to the defaults

                                      --the gradient stroke start at the center of the selection

                                      --the gradient stroke length to half the width of the selection

                                       

                                      tell application "Adobe InDesign CC 2014"

                                       

                                          --gets the bounds of the selection then half its width and height

                                          set {a, b, c, d} to visible bounds of selection

                                          set cw to (d - b) * 0.5

                                          set ch to (c - a) * 0.5

                                       

                                          set gradient stroke start of selection to {b + cw, a + ch}

                                          set gradient stroke length of selection to cw

                                      end tell

                                      ----------------------------------------------------------------

                                      • 16. Re: InDesign what determines where the different colours of a gradient swatch begins?
                                        Laubender Adobe Community Professional & MVP

                                        Hi Rob,

                                        just tested your script.


                                        It is working as expected for shapes that are:

                                        1. Squares

                                        2. Circles

                                        3. Rectangles and ovals that are constructed in landscape size.

                                         

                                        It is not working on shapes that are constructed in portrait size.
                                        In this case other rules apply.

                                         

                                        More on that later, if I can describe the rules that apply for landscape elements better.
                                        I assume that the 4 values describing the effective area for a radial gradient are:

                                         

                                        Default gradientStrokeStart should be the center of the shape.
                                        xCenter = gradientStrokeStart[0];

                                        yCenter = gradientStrokeStart[1];

                                         

                                        bounds of effective area of radial gradient in y1 x1 y2 x2 are:

                                        [

                                         

                                        yCenter - heightOfShape / 2 * f ,

                                        xCenter - widthOfShape / 2 * f ,

                                        yCenter + heightOfShape / 2 * f ,

                                        xCenter + widthOfShape / 2 * f

                                         

                                        ]

                                         

                                        where factor f is heightOfShape / widthOfShape .

                                         

                                        Still have to verify this.

                                         

                                        Regards,
                                        Uwe

                                        • 17. Re: InDesign what determines where the different colours of a gradient swatch begins?
                                          rob day Adobe Community Professional & MVP

                                          It is not working on shapes that are constructed in portrait size.

                                          In this case other rules apply.

                                          Looks to me like the default gradient stroke length is the longer distance of either the width/2 or height/2. So this seems to work for both portrait or landscape.

                                           

                                           

                                          -------------------------------------------

                                          --resets the stroke gradient to the defaults

                                          --the gradient stroke start at the center of the selection

                                          --the gradient stroke length to half the width of the selection

                                           

                                          tell application "Adobe InDesign CC 2014"

                                             

                                              --gets the bounds of the selection then half its width and height

                                              set {a, b, c, d} to visible bounds of selection

                                              set cw to (d - b) * 0.5

                                              set ch to (c - a) * 0.5

                                             

                                              set gradient stroke start of selection to {b + cw, a + ch}

                                              if cw is greater than or equal to ch then

                                                  set gradient stroke length of selection to cw

                                              else

                                                  set gradient stroke length of selection to ch

                                              end if

                                          end tell

                                          ---------------------------------------------

                                          • 18. Re: InDesign what determines where the different colours of a gradient swatch begins?
                                            rob day Adobe Community Professional & MVP

                                            You're more fluent in JS than I am, but I think this should work:

                                             

                                             

                                             

                                            var s=app.activeDocument.selection[0].visibleBounds; 
                                            var cw=(s[3]-s[1])*.5; 
                                            var ch=(s[2]-s[0])*.5; 
                                            
                                            app.activeDocument.selection[0].gradientStrokeStart = [s[1]+cw,s[0]+ch];
                                            
                                            if (cw>=ch){
                                                app.activeDocument.selection[0].gradientStrokeLength = cw
                                            }else{
                                                app.activeDocument.selection[0].gradientStrokeLength = ch
                                            }
                                            
                                            • 19. Re: InDesign what determines where the different colours of a gradient swatch begins?
                                              Andreas Jansson Level 2

                                              Hi,

                                               

                                              Here my settings:

                                              Capture.JPGCapture2.JPG

                                               

                                              I believe those are the defaults.

                                               

                                              I changed them all (switched to "Scaling percentage" and unchecked all of the transform options), but there was no difference when repeating the stroke width test as described above.

                                               

                                              Robs script however resets the stroke gradient, so that it looks the same as when I select another swatch and back to the gradient.

                                              Shouldn't InDesign do that "reset" when you change stroke width..?

                                               

                                              Best regards,

                                              Andreas

                                              • 20. Re: InDesign what determines where the different colours of a gradient swatch begins?
                                                Laubender Adobe Community Professional & MVP

                                                Hi Andreas,

                                                hi Rob!

                                                 

                                                Rob's script is working fine.
                                                In the meanwhile I tested on.

                                                 

                                                What's now clear to me is the following.

                                                And this applies only to graphic frames.

                                                Not to text or the fill or stroke of table cells:

                                                 

                                                1. If you apply a swatch like [Black] to a graphic frame where a gradient is applied—doesn't matter if on stroke or fill or both—and re-apply a gradient, the gradient is applied as by default.

                                                 

                                                2. I think it will not matter how the objects are scaled. Sorry. I thought, that could influence the look of the radial gradient.

                                                 

                                                Most important:

                                                3. It matters if objects are constructed in landscape or portrait direction once in their lifetime .
                                                Two different things happen, if you take the landscape route ( green ) or the portrait route ( magenta ) to get to a circle or a square:

                                                 

                                                RadialGradientApplied-Portrait-or-Landscape-Route.png

                                                 

                                                Note: I rotated both objects on the landscape route to show a case only. You could rotate the objects to any angle and the same look is applied if you do the stroke with a radial gradient. The only important thing is how you constructed your square and circle.

                                                 

                                                 

                                                Note: The rules for radial gradients applied to text or text cells (background fill and strokes) will be different.

                                                 

                                                Regards,
                                                Uwe

                                                • 21. Re: InDesign what determines where the different colours of a gradient swatch begins?
                                                  Laubender Adobe Community Professional & MVP

                                                  https://forums.adobe.com/people/Andreas+Jansson  wrote

                                                  … Shouldn't InDesign do that "reset" when you change stroke width..? …

                                                  Apparently InDesign does not reset.
                                                  You have to reset the gradient by using Rob's script or apply a swatch like [Black]—not [None]—and re-apply the radial gradient.

                                                   

                                                  See this here:

                                                   

                                                  ChangingStrokeWeight-GradientlengthWillNotChange.png

                                                   

                                                  Regards,
                                                  Uwe

                                                  • 22. Re: InDesign what determines where the different colours of a gradient swatch begins?
                                                    rob day Adobe Community Professional & MVP

                                                    Shouldn't InDesign do that "reset" when you change stroke width..?

                                                    I don't think a gradient applied to a stroke works the way you are assuming it does. The stroke thickness won't change the way the gradient is applied. Here the stroke is set to the inside of a 400 point diameter circle:

                                                     

                                                    If the stroke is 100 points half the gradient is applied

                                                     

                                                    s100.png

                                                     

                                                    A 200 point stroke:

                                                     

                                                    s200.png

                                                     

                                                    I can also use the Gradient Tool to change the start and end point of the applied gradient to show that the stroke thickness doesn't matter:

                                                     

                                                    gs.png

                                                    Screen Shot 2017-03-27 at 8.33.57 AM.png