Quantcast
Channel: Adobe Community : Popular Discussions - Illustrator Scripting
Viewing all articles
Browse latest Browse all 12845

Script inverte posições pelo centro do objeto

$
0
0

Olá a todos!

 

Preciso de uma Script que inverta posições de objetos selecionados pelo centro da imagem.

Consegui fazer a inversão mas não consigo alinhar centro com centro. Alguém pode me ajudar?

Obrigado!

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

Hello everyone!

I need a script that reverses positions of selected objects to the center of the image .
I managed to turn it around but I can not align center center. Can someone help me?
Thank you!

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

 

try {

var docRef = activeDocument;

if (documents.length>0) {

  if (docRef.selection.length == 2) {

  mySelection = docRef.selection;

  //if object is a (collection of) object(s) not a text field.

  if (mySelection instanceof Array) {

  //initialize vars

  //create bounding objects

  var origBounds = mySelection[0].geometricBounds;

  var initBounds = mySelection[1].geometricBounds;

  //define paramaters of top object

  var oul_x = origBounds[0];

  var oul_y = origBounds[1];

  var olr_x = origBounds[2];

  var olr_y = origBounds[3];

  var oSelWidth = (olr_x-oul_x);

  var oSelHeight = (oul_y-olr_y);

  var oSelPos = [oul_x, oul_y];

  //define paramaters of bottom object

  var ul_x = initBounds[0];

  var ul_y = initBounds[1];

  var lr_x = initBounds[2];

  var lr_y = initBounds[3];

  var mySelWidth = (lr_x-ul_x);

  var mySelHeight = (ul_y-lr_y);

  var mySelPos = [ul_x, ul_y];

  //apply transforms to selection[0]

  mySelection[1].height = mySelHeight;

  mySelection[1].width = mySelWidth;

  mySelection[0].position = mySelPos;

  //apply transforms to selection[1]

  mySelection[0].height = oSelHeight;

  mySelection[0].width = oSelWidth;

  mySelection[1].position = oSelPos;

 

            } else {

        }

    }

}

} catch(e){

}


Viewing all articles
Browse latest Browse all 12845

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>