3 Replies Latest reply on Dec 6, 2017 7:53 AM by pixxxel schubser

# Transform an object in a trapezoidal way

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

• ###### 1. Re: Transform an object in a trapezoidal way

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

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

• ###### 2. Re: Transform an object in a trapezoidal way

That's supposed to be 'transform'?

• ###### 3. Re: Transform an object in a trapezoidal way

Oops. Is there a black hole in the near?

the last line should be:

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