-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathhdtr.jsx
46 lines (39 loc) · 1.55 KB
/
hdtr.jsx
1
#include "modules/guides.jsx"#include "modules/fileInfo.jsx"#include "modules/masks.jsx"#include "modules/json/json.js"var hdtrConfig = { direction : Direction.VERTICAL , maskOffset : 5 , guidesOffset : 5 , guideSpacing : function () { if (this.direction == Direction.VERTICAL) { return this.docDimensions.width / this.shots; } else { return this.docDimensions.height / this.shots; } }};//Open dialog to select source filesvar files = app.openDialog();hdtrConfig.shots = files.length;hdtrConfig.docDimensions = getImageFileDimensions(files[0]);hdtrConfig.startTransitionAt = hdtrConfig.guidesOffset * hdtrConfig.guideSpacing();hdtrConfig.offset = hdtrConfig.maskOffset * hdtrConfig.guideSpacing();var hdtrDocument = app.documents.add (hdtrConfig.docDimensions.width, hdtrConfig.docDimensions.height, hdtrConfig.docDimensions.resolution);drawGuides(hdtrDocument, hdtrConfig.direction, hdtrConfig.shots);var index;for (index = 0; index < files.length; index++) { addLayerFromFile(hdtrDocument, files[index]); if (index > 0) { var refGuide = hdtrDocument.guides[index]; var from = refGuide.coordinate + hdtrConfig.startTransitionAt - hdtrConfig.offset; var to = refGuide.coordinate + hdtrConfig.startTransitionAt + hdtrConfig.offset createLayerMask(hdtrDocument, hdtrDocument.activeLayer, false); fillWithGradient(from, hdtrConfig.docDimensions.height /2, to, hdtrConfig.docDimensions.height /2); }}