2 Replies Latest reply on Aug 4, 2016 1:17 PM by Silly-V

    Scaling a pathItem over and over.

    richardw26639360

      I'm to create a hexagon and duplicating it 23 times. But I also need each duplicate to scale 96% off the one before it. This is what I have so far...

       

      var doc = app.activeDocument;

      var p = doc.pathItems.polygon(0,0,23,6);

      p.filled = false;

      p.stroked = true;

      q = 23;

      percentageX = 96

      percentageY = percentageX

       

       

        for (var j=0; j<q; j++)

      {myDuplicate = p.duplicate();

                  }

        for (var k=0; k<myDuplicate; k++)

        { myDuplicate.resize(percentageX, percentageY);}

       

      It only scales once and then every duplicate after that is the same size as the first duplicate. How can I get it to scale each duplicate to be smaller than the duplicate before it?

        • 1. Re: Scaling a pathItem over and over.
          Alexander Ladygin Level 2

          as an option:

          var doc = app.activeDocument,
              p = doc.pathItems.polygon(0, 0, 23, 6),
              myDuplicate = p,
              percentageX = 96,
              percentageY = percentageX,
              q = 23;
          
          p.filled = false;
          p.stroked = true;
          
          for ( var i = 0; i < q; i++) {
              myDuplicate = myDuplicate.duplicate();
              myDuplicate.resize(percentageX, percentageY);
          }
          
          
          
          • 2. Re: Scaling a pathItem over and over.
            Silly-V Adobe Community Professional

            You can also try to use this cool effect method:

             

            #target illustrator 

            function test(){  

                var doc = app.activeDocument; 

                var p = doc.selection[0]; 

             

                var effectStr_2 = 

                '<LiveEffect name="Adobe Transform">' + 

                    '<Dict data="' + 

                        'R scaleH_Factor 0.96 ' + 

                        'R moveV_Pts 0.00 ' + 

                        'R scaleV_Percent 96.00 ' + 

                        'I pinPoint 4 ' +

                        'B scaleLines 0 ' + 

                        'I numCopies 23 ' + 

                        'B randomize 0 ' + 

                        'R rotate_Radians 0.00 ' + 

                        'R moveH_Pts 0.00 ' + 

                        'R scaleV_Factor 0.96 ' + 

                        'B reflectY 0 ' + 

                        'B reflectX 0 ' + 

                        'R rotate_Degrees 0.00 ' + 

                        'R scaleH_Percent 96.00 ' + 

                        'B transformPatterns 1 ' + 

                    '"/>' + 

                '</LiveEffect>'; 

                p.applyEffect(effectStr_2); 

            }  

            test();