Skip to main content
raulM
Participant
December 6, 2017
Question

Transform an object in a trapezoidal way

  • December 6, 2017
  • 1 reply
  • 913 views

Hey all,

The last days, I was trying to find my way into scripting to automatize some workflows.

I don’t really know where to start on this specific project, so I finally take a shortcut and try to find some answers from more experienced people. 😉

Basically I’m trying to change the width of an object/group.

The width should be changed in two different values — one width-change on the top, another one on the bottom. The values are calculated by: width*cos(y). Where Y is the Y-Value of the maximum or minimum. All points between the maximum and minimum should be changed in a linear way. Similar to a trapezoid.

A bit like it can be done manually with the free-transform-tool:

(The shapes are representing the transformation, not the actual paths!)

I’m not sure, if that’s even possible. Maybe someone could give me a hint where to start or share some experiences.

Merci beaucoup and have a great Day!

Raul

(Sorry, I’m totally struggling to describe this in english... )

This topic has been closed for replies.

1 reply

pixxxelschubser
Community Expert
Community Expert
December 6, 2017

Sorry, but your image is not visible.

It's not clear for me what you really want.

But perhaps this old snippet by CarlosCanto will point you to the right direction

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

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

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%

nsform (im, true, true, true, true, 1, undefined);

Have fun

Silly-V
Legend
December 6, 2017

That's supposed to be 'transform'?

pixxxelschubser
Community Expert
Community Expert
December 6, 2017

Oops. Is there a black hole in the near?

the last line should be:

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