how to change the position of the active layer?

Anyone, especially newbies, asking for help with Photoshop Scripting and Photoshop Automation - as opposed to those contributing to discussion about an aspect of Photoshop Scripting

Moderators: Tom, Kukurykus

szypi1989

how to change the position of the active layer?

Post by szypi1989 »

how to change the position of the active layer?

Professional AI Audio Generation within Adobe Premiere Pro - Download Free Plugin here

Mike Hale

how to change the position of the active layer?

Post by Mike Hale »

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()
szypi1989

how to change the position of the active layer?

Post by szypi1989 »

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?

Post by Mike Hale »

You can get the current position of a layer with the layer.bounds property.
szypi1989

how to change the position of the active layer?

Post by szypi1989 »

don't work.please about example
kpt

how to change the position of the active layer?

Post by kpt »

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"));
oceanwind

how to change the position of the active layer?

Post by oceanwind »

tks,I'm looking for such a function.