//加载自定义函数集 var scriptPath = $.fileName; var scriptFolder = new File(scriptPath).parent; var scriptFolderAbsolutePath = scriptFolder.absoluteURI; $.evalFile(File(scriptFolderAbsolutePath + "/jsonFunction.jsx")); //重命名 layerRename(); var layerslength = app.activeDocument.layers.length; // =====创建时间轴================================================== newFrameTimeline(); //重置时间轴 resetTimeline() // 帧率================================================= var frameRate = Number(prompt("输入帧率", 5)); if (frameRate <= layerslength) { frameRate = layerslength; } if (frameRate % 2 == 1) { frameRate = frameRate + 1; } //100透明度点 var rate100 = Math.ceil(frameRate / 2); //基础透明度 var TransparencyOdd = 100 / (Math.floor(frameRate / 2)); for (layname = 1; layname <= layerslength; layname++) { layerclick(layname); if (layname != 1) { transparency(0); } else { transparency(100); } } // var loop = confirm('循环(确认)/不循环渐变(取消)'); function layerHidden() { //每桢时间 var t = 0.01; for (layname = 2; layname <= layerslength; layname++) { layerclick(layname); kTime(t); var tra_val = 0; for (oneShot = 2; oneShot <= rate100; oneShot++) { if (layname <= layerslength) { newK(); if (oneShot < rate100) { tra_val = Math.floor(TransparencyOdd * (oneShot - 1)); transparency(tra_val); } else if (oneShot == rate100) { tra_val = 100; transparency(100); } kTime(t); } } } // for (layname = layerslength; layname >1; layname--) { // layerclick(layname); // kTime(t); // tra_val = 100; // for (oneShot = layerslength; oneShot >= 2; oneShot--) { // if (layname > 1) { // newK(); // if (oneShot > rate100) { // tra_val = tra_val - TransparencyOdd; // transparency(tra_val); // } // kTime(t); // } // } // } } layerHidden();