SheridanCoriana6

Photopea - Fade IN OUT Animation Script

Apr 1st, 2023 (edited)
181
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.04 KB | Source Code | 0 0
  1. var orig = app.activeDocument.activeLayer;
  2. var cnt = 10;
  3. var increaseOpacity = 10;
  4. var opacity = 0;
  5.  
  6. orig.name = "_a_" + orig.name;
  7.  
  8. for (var i = 1; i < cnt; i++) {
  9. var nlay = orig.duplicate();
  10.  
  11. opacity += increaseOpacity;
  12. nlay.opacity = Math.min(opacity, 100);
  13.  
  14. if (nlay.name !== "Black") {
  15. nlay.name = orig.name + "_" + opacity + "%";
  16. }
  17. }
  18.  
  19. var background = app.activeDocument.artLayers.add();
  20. background.name = "Black";
  21. background.move(orig, ElementPlacement.PLACEBEFORE);
  22. app.activeDocument.selection.fill(app.foregroundColor);
  23.  
  24. background.move(app.activeDocument.layers[10], ElementPlacement.PLACEAFTER);
  25.  
  26. var blackCopy = app.activeDocument.artLayers.getByName("Black").duplicate();
  27. blackCopy.name = "_a_Black Copy";
  28. blackCopy.move(app.activeDocument.artLayers.getByName("_a_Background_10%"), ElementPlacement.PLACEBEFORE);
  29.  
  30. if (orig.name === "_a_Background") {
  31.  
  32. orig.name += ",2000"; // Add ",2000" to the end of the layer name
  33. } else {
  34. orig.name = layer.name + ",2000"; // Add ",2000" to the end of the layer name
  35.  
  36. }
  37.  
  38.  
  39.  
Tags: Photopea
Advertisement
Add Comment
Please, Sign In to add comment