Skip to content Skip to sidebar Skip to footer

Photoshop Move Layer Along Y-axis

I'm working on a script that will move a layer, right, left, up, or down. This depends upon which edge of the layer is inside the canvas. I've managed to get the layer moving left

Solution 1:

The first thing you probably want to do in a situation like this is to check the documentation. For .translate() we can find the following:

enter image description here

so to move horizontally we would use deltaX and to move vertically deltaY, in your code you're giving to .translate() only deltaX, so as expected your layer is being moved horizontally. To fix this pass 0 as a first argument and your Height-Y1 as a second one:

activeDocument.activeLayer.translate(0, Height - Y1);

Post a Comment for "Photoshop Move Layer Along Y-axis"