# Access SmartObject transform properties?

**URL:** <https://forums.creativeclouddeveloper.com/t/access-smartobject-transform-properties/5349>\
**Category:** UXP Plugin API\
**Created:** [October 15, 2022, 11:30am UTC](https://forums.creativeclouddeveloper.com/t/access-smartobject-transform-properties/5349 "2022-10-15T11:30:55Z")\
**Posts on this page:** 1\
**Showing post:** 6

<div class="post-metadata">

**Author:** ![SkipIntro](https://sea1.discourse-cdn.com/flex015/user_avatar/forums.creativeclouddeveloper.com/skipintro/32/2338_2.png) [@SkipIntro](https://forums.creativeclouddeveloper.com/u/SkipIntro)\
**Post date:** [October 18, 2022, 4:05pm UTC](https://forums.creativeclouddeveloper.com/t/access-smartobject-transform-properties/5349/6 "2022-10-18T16:05:55Z")

</div>

Yeah no rotation. But you should be able to reliably calculate rotation by using the _smartObjectMore.transform_ array. Also, Photoshop doesn’t give smart objects an anchor point, so the UI shows the position as the center (average) of the 4 corners:

```auto
function rotationFromCorners(points) {
	var A = points.upperLeft;
	var B = points.upperRight;
	var radians = Math.atan2(B.y - A.y, B.x - A.x);
	return radians * (180/Math.PI);
}

function getAvgPointPosition(points) {
	var xa = (points.upperLeft.x + points.upperRight.x + points.lowerRight.x + points.lowerLeft.x)/4;
	var ya = (points.upperLeft.y + points.upperRight.y + points.lowerRight.y + points.lowerLeft.y)/4;
	return {x:xa, y:ya};
}

// BatchPlay smartObjectMore.transform array of a 1920x1080 image
var t = [
	0,
	0,
	1920,
	0,
	1920,
	1080,
	0,
	1080
];

// Parse points from .transform into something more readable
var smartObjectPoints = {
	upperLeft: {x:t[0], y:t[1]},
	upperRight: {x:t[2], y:t[3]},
	lowerRight: {x:t[4], y:t[5]},
	lowerLeft: {x:t[6], y:t[7]}
};

var smartObjectRotation = rotationFromCorners(smartObjectPoints);
var smartObjectPosition = getAvgPointPosition(smartObjectPoints);

```

Keep in mind you may start to get inaccuracies from a simple 2-point rotation calculation if you start to throw stuff like _Transform \> Skew/Distort/Perspective_ into the mix. Then you may need to compare .transform to the _smartObjectMore.nonAffineTransform_ data. It can get a little tricky, but if you know you’ll be dealing with mostly just basic SO transforms, using the corners should be consistent.

---

_[View the full topic](https://forums.creativeclouddeveloper.com/t/access-smartobject-transform-properties/5349)._
