3 Replies Latest reply on Jul 26, 2013 2:57 PM by CarlosCanto

    Inversing A Gradient

    Prails.deisgn Level 1

      Hey Guys,


      I'm trying to inverse all gradients within a document using Javascript

      I can't find the property to call to inverse them in any of the PDF's I have, and I'm having trouble calling gradients in general I can't even rename them at the moment.


      Any ideas?

        • 1. Re: Inversing A Gradient
          Prails.deisgn Level 1

          Here's an example of what i'm trying to do, I still can't specifically target just a gradient, I can only target paths as a whole.


          #target Illustrator


          //  Hopefully this controls Gradients


          var doc = app.activeDocument;




          //Inverses Gradient direction

          function idPaths(doc){


                  doc.pathItems.gradients = true;

                  doc.pathItems.inverse = true;

                  doc.pathItems[i].name= 'Superman '+(i+1)





          // Still doesn't work ...

          // function idSad(user) = true

          • 2. Re: Inversing A Gradient
            Prails.deisgn Level 1

            Found a workable solution but it requires the user to select the gradient, and it only does one at a time, so getting closer but not there.


            Found this script here on the foum:




            #target Illustrator


            // GradientBlackWhite_rotated.jsx

            // requires an open document and one selected object


            var newGradient = app.activeDocument.gradients.add();

            var colorOfGradient = new GradientColor();

            var myGradientAngle = 180;

            colorOfGradient.gradient = newGradient;

            doc.selection[0].fillColor = colorOfGradient;

            /*Thanx to John Wundes for this -->*/doc.selection[0].rotate(myGradientAngle, false, false, true, false, Transformation.CENTER);



            • 3. Re: Inversing A Gradient
              CarlosCanto Adobe Community Professional & MVP

                      doc.pathItems.gradients = true;

                      doc.pathItems.inverse = true;


              dude, are you writing your own properties? you have to go to the OMV or the Reference and use what's available, gradients and inverse do not exist.