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

flip objext or text in JS

Guest
Jul 16, 2009 Jul 16, 2009

I can't find a way to flip an object or text horizontally or vertically using javascript. I looked at the transfomation matrix but that looks like it only scales, offsets and rotates an object or text.

Can I flip an object or text (horizontally or vertically) using javascript?

Thanks,

Mark

TOPICS
Scripting
1.5K
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
Advocate ,
Jul 16, 2009 Jul 16, 2009

Try scaling it -100% in the direction you want it to flip

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
Guide ,
Jul 17, 2009 Jul 17, 2009

This is AppleScript but may provide an indication to the values you require for your matrix in JavaScript.

I did notice that even with about centre some times the bounds moved so I get the position then reposition you will need to test.

Transform about vertical axis:

tell application "Adobe Illustrator"

activate

set Doc_Ref to the current document

tell Doc_Ref

set Group_XY to position of group item 1 of layer 1

set RefVert_Matrix to ¬

{class:matrix, mvalue_a:-1.0, mvalue_b:0.0, mvalue_c:0.0, mvalue_d:1.0, mvalue_tx:0.0, mvalue_ty:0.0}

transform group item 1 of layer 1 using RefVert_Matrix about center

set position of group item 1 of layer 1 to Group_XY

end tell

end tell

Transform about horizontal axis:

tell application "Adobe Illustrator"

activate

set Doc_Ref to the current document

tell Doc_Ref

set Group_XY to position of group item 1 of layer 1

set RefHoz_Matrix to ¬

{class:matrix, mvalue_a:1.0, mvalue_b:0.0, mvalue_c:0.0, mvalue_d:-1.0, mvalue_tx:0.0, mvalue_ty:0.0}

transform group item 1 of layer 1 using RefHoz_Matrix about center

set position of group item 1 of layer 1 to Group_XY

end tell

end tell

hope this helps

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
Guest
Jul 17, 2009 Jul 17, 2009
LATEST

Thanks guys. It wasn't obvious to me that "-" scale would flip the object.

In JS:

var mytextframe = mydoc.textFrames.add();
mytextframe.contents = "TEXT";

var myMatrix = getScaleMatrix(100,-100);  //100,-100 flip vert, -100,100  flip horiz
mytextframe.transform(myMatrix);

Thanks again,

Mark

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