how to change the position of the active layer?
-
szypi1989
how to change the position of the active layer?
how to change the position of the active layer?
-
Mike Hale
how to change the position of the active layer?
If you mean move the layer's contents then you use artLayer.translate().
If you mean move the layer in the layer stack so it is above or below where it is now you use artLayer.move()
If you mean move the layer in the layer stack so it is above or below where it is now you use artLayer.move()
-
szypi1989
how to change the position of the active layer?
ok.I mean the active layer?,and how to get the position of the active layer?
-
Mike Hale
how to change the position of the active layer?
You can get the current position of a layer with the layer.bounds property.
-
kpt
how to change the position of the active layer?
Code: Select all
moveTo = function(x, y) {
var l = app.activeDocument.activeLayer;
var b = l.bounds;
var x1 = b[0].as("px");
var y1 = b[1].as("px");
var x2 = b[2].as("px");
var y2 = b[3].as("px");
var xc = x1 + (x2-x1)/2;
var yc = y1 + (y2-y1)/2;
l.translate(x-xc, y-yc);
};
moveTo(new UnitValue(1000, "px"), new UnitValue(1000, "px"));
moveTo = function(x, y) {
var l = app.activeDocument.activeLayer;
var b = l.bounds;
var x1 = b[0].as("px");
var y1 = b[1].as("px");
var x2 = b[2].as("px");
var y2 = b[3].as("px");
var xc = x1 + (x2-x1)/2;
var yc = y1 + (y2-y1)/2;
l.translate(x-xc, y-yc);
};
moveTo(new UnitValue(1000, "px"), new UnitValue(1000, "px"));