2 Replies Latest reply on Oct 3, 2014 11:16 PM by ahawktom

    Scripting Layer Opacity change

    ahawktom

      Hello!

       

      I want to create a script that decreases current layer opacity by 5. Here's what I have now:

      app.activeDocument.activeLayer.opacity -= 5;
      

       

      The problem is, when I map the script to a hotkey and press it multiple times (e.g. to set opacity to 50%), it goes normal from 100 to 95, from 95 to 90 and so on until 75%. From that point, it goes to 69% (should be 70%). Then it proceeds as it should (69 -> 64, 64 -> 59).

      It also breaks at 24% (24 -> 18), if that matters.

       

      I use Adobe Photoshop CS6 on Windows 8.1 (x64).

       

      Why is this happening (decrease by 6 when I have 5 in my code)? Am I doing something wrong? Sorry if this question is stupid, I am just new to Photoshop scripting...