Exit
  • Global community
    • Language:
      • Deutsch
      • English
      • Español
      • Français
      • Português
  • 日本語コミュニティ
  • 한국 커뮤니티
0

Scaling a pathItem over and over.

Community Beginner ,
Aug 04, 2016 Aug 04, 2016

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?

TOPICS
Scripting
367
Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Adobe
Participant ,
Aug 04, 2016 Aug 04, 2016

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);

}

Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Valorous Hero ,
Aug 04, 2016 Aug 04, 2016
LATEST

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(); 

Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines