Skip to main content
Known Participant
July 3, 2013
Answered

How can i shear rectangle to JavaScript?

  • July 3, 2013
  • 1 reply
  • 1560 views

How can i shear rectangle?

there is similar question.

(http://forums.adobe.com/message/1103495#1103495)

 

But i can't understand answer in there.

 

JavaScript Reference has 'getRotationMatrix', 'getScaleMatrix', 'getTranslationMatrix'.

But there is NOT 'getShearMatrix'!!

how i can shear rectangle?

if you can as javascript, show me your code please.

thank you.

This topic has been closed for replies.
Correct answer CarlosCanto

use the Matrix properties b & c, the actual skewing values are in percentages of the objects dimensions, not degrees as in the UI...if you need angle values, that would be your homework.

draw a rectangle, select it and run the script to skew or shear 50%

// skew or shear selection, carlos canto 07/04/13

// http://forums.adobe.com/message/5475881#5475881

var idoc = app.activeDocument;

var sel = idoc.selection[0];

var im = app.getIdentityMatrix();

//im.mValueB = .5; // skew y 50%

im.mValueC = .5; // skew x 50%

sel.transform (im, true, true, true, true, 1, undefined);

1 reply

CarlosCanto
Community Expert
CarlosCantoCommunity ExpertCorrect answer
Community Expert
July 4, 2013

use the Matrix properties b & c, the actual skewing values are in percentages of the objects dimensions, not degrees as in the UI...if you need angle values, that would be your homework.

draw a rectangle, select it and run the script to skew or shear 50%

// skew or shear selection, carlos canto 07/04/13

// http://forums.adobe.com/message/5475881#5475881

var idoc = app.activeDocument;

var sel = idoc.selection[0];

var im = app.getIdentityMatrix();

//im.mValueB = .5; // skew y 50%

im.mValueC = .5; // skew x 50%

sel.transform (im, true, true, true, true, 1, undefined);

kimDino8Author
Known Participant
July 4, 2013

Thank you! thats all i want

You helpful to me.