I am trying to create a basic animation in which a white text object is a clipping mask for a blood drip graphic that slowly moves down to fill in the text. My plan is to create multiple frames and piece them together in FinalCut as the beginning of a video. I found a script that does what I am looking to do:
Script to move layer in photoshop
I am unable to get the script to work, and am given the following error:
"Error 2: docReg is undefined
Line: 20 -> docRef.exportDocument (pngFile, ExportType.SAVEFORWEB, opts);"
Here is the js that I am using:
// Save selected layer to variable:
app.preferences.rulerUnits = Units.PIXELS;
for (var dy = 1; dy < 50 ; dy++) {
activeDocument.activeLayer.translate(0,2);
var opts;
opts = new ExportOptionsSaveForWeb();
opts.format = SaveDocumentType.PNG;
opts.PNG8 = false;
opts.quality = 100;
var suffix = zeroPad(dy,5)
var pngFile = new File("/Desktop/filename"+suffix+".png");
//Folder path for new images
docRef.exportDocument (pngFile, ExportType.SAVEFORWEB, opts);
}
function zeroPad(n, s) {
n = n.toString();
while (n.length < s) n = '0' + n;
return n;
};
Thank you for your help!
var docRef = app.activeDocument;
on the first line and try to execute again because in your script there isn't docRef defined and it seems you want to export from activeDocument :) – Mr.Online May 14 '19 at 4:48