When I play the animation in photoshop, it looks fine. Every layer is in the correct position. When I run my script that saves each group to a png, the results have some layers offset.
I believe layers have weird issues with positions in animations. An image in a layer could have a different position in one frame and not another frame. I believe I'd have to get the script to step the frame in the animation to get the correct position, but I'm not sure how I would do that.
var set;
var layer;
var count = 0;
for(var i = 0; i < app.activeDocument.layerSets.length; i ++)
{
set = app.activeDocument.layerSets[i];
set.visible = false;
count ++;
}
for(var i = 0; i < app.activeDocument.layerSets.length; i ++)
{
set = app.activeDocument.layerSets[i];
set.visible = true;
// save
var fileName = set.name.replace(/[\\\*\/\?:"\|<> ]/g,'');
if(fileName.length ==0) fileName = "autoname";
var handle = File(app.activeDocument.path + "/" + fileName + ".png");
pngSaveOptions = new PNGSaveOptions();
activeDocument.saveAs(handle, pngSaveOptions, true, Extension.LOWERCASE);
set.visible = false;
}
alert("Saved " + count + " images.");
The correct animation plays in photoshop. The resulting .pngs are incorrect. https://imgur.com/a/y9PLPUX