Hi Jim,

I thought your problem was with the positioning of the gradient feather within the rectangle, and I really don’t understand why you’re so obsessed with those ***** numbers!

But anyway, FWIW here are some lines of code to reset those numbers to the numbers you want:

```
var rectangle = app.activeDocument.pages[0].rectangles.add();
var geometricBounds = rectangle.geometricBounds;
var currentMatrix = rectangle.transformValuesOf(CoordinateSpaces.PASTEBOARD_COORDINATES)[0];
$.writeln(currentMatrix.matrixValues.toString()); // 1,0,0,1,5,-415.944881889
var invertedMatrix = currentMatrix.invertMatrix();
rectangle.transform(CoordinateSpaces.PASTEBOARD_COORDINATES, AnchorPoint.CENTER_ANCHOR, invertedMatrix);
rectangle.geometricBounds = geometricBounds;
currentMatrix = rectangle.transformValuesOf(CoordinateSpaces.PASTEBOARD_COORDINATES)[0];
$.writeln(currentMatrix.matrixValues.toString()); // 1,0,0,1,0,0
```

Line 1 – we’re creating our rectangle

Line 2 – we’re assigning the geometric bounds of the rectangle to a variable (for use later). This isn’t critical for what we’re doing.

Line 3 – we’re getting the transformation matrix (in the pasteboard space) from the rectangle. This is the code you already have.

Line 4 – we’re simply logging the matrix values of the transformation matrix. These are the values that you want to change. On my computer the numbers I get are: 1,0,0,1,5,-415.944881889.

The last two numbers are the values of the horizontalTranslation and verticalTranslation properties of the transformation matrix.

My guess is that when InDesign creates a page item, such as our rectangle, it initially exists somewhere in the pasteboard space and InDesign simply moves it so that it sits at the top left corner of the page – where you see a newly created page item. That moving is a transformation, the values of which are appended to the object’s transformation matrix.

Lines 5 and 6 are the critical lines of code.

Line 5 – we create a new inverted transformation matrix from the current transformation matrix. The function invertMatrix() inverts (reverses) the transformations in the source matrix. In other words, if the source matrix says, as it were, “move 20 units horizontally to the right”, the inverted matrix will say “move 20 units horizontally to the left”.

Line 6 – we apply our inverted transformation matrix to the rectangle using the transform() function.

Line 7 – we re-apply the original geometric bounds to the rectangle so it again sits at the top left corner of the page. Interestingly, if you comment out this line and run the code, then choose “Entire Pasteboard” from the View menu, you see the rectangle right in the centre of the pasteboard, which tells me that that is where InDesign initially creates it before moving it to the top left corner of the page.

Lines 8 and 9 are a dupe of lines 3 and 4, just so we can check what values the transformation matrix now has. I get: 1,0,0,1,0,0.

Philip