GUI with sliders that change opacity on multiple layers

Anyone, especially newbies, asking for help with Photoshop Scripting and Photoshop Automation - as opposed to those contributing to discussion about an aspect of Photoshop Scripting

Moderators: xbytor, DavideBarranca, Paul MR

zachbright
Posts: 1
Joined: Fri Mar 09, 2018 7:41 pm

GUI with sliders that change opacity on multiple layers

Postby zachbright » Fri Mar 09, 2018 8:03 pm

Hello! Total new guy here. I have an action that creates a document with a background layer and two layers above it. I would like to add an end step that creates a GUI with two sliders, each slider controlling the opacity of the 2 layers above the background layer, IE the first slider controls top layer opacity, second slider controls middle layer opacity. It would be ideal if this previews in real time as you move the sliders. Is this possible?

Thanks!

Zach

wasfiwasfi
Posts: 43
Joined: Fri Nov 04, 2016 8:29 am

Re: GUI with sliders that change opacity on multiple layers

Postby wasfiwasfi » Sat Mar 17, 2018 2:30 pm

yes, by using a script that runs at the end of the action.

luis miguel
Posts: 16
Joined: Thu Oct 27, 2016 9:56 am

Re: GUI with sliders that change opacity on multiple layers

Postby luis miguel » Thu Mar 22, 2018 7:20 pm

What you need can be found in this post
It would be ideal if this previews in real time as you move the sliders. Is this possible?
This is a bit difficult to do
so no it is not possible.

wasfiwasfi
Posts: 43
Joined: Fri Nov 04, 2016 8:29 am

Re: GUI with sliders that change opacity on multiple layers

Postby wasfiwasfi » Sat Apr 28, 2018 9:15 pm

it is possible !

check this out

Code: Select all

var dlg = new Window("dialog{text:'Script Interface',bounds:[100,100,561,269],\
iwtfkhamhc:EditText{bounds:[16,16,444.95,94] , text:'Your text goes here' ,properties:{multiline:false,noecho:false,readonly:false}},\
button0:Button{bounds:[17,102,117,122] , text:'Save' },\
button1:Button{bounds:[236,101,336,121] , text:'Cancel' },\
button2:Button{bounds:[345,101,445,121] , text:'Whatever' },\
slider0:Slider{bounds:[18,138,173,148] , minvalue:0,maxvalue:100,value:0},\
checkbox0:Checkbox{bounds:[190,133,261,154] , text:'Checkbox Text' },\
dropdown0:DropDownList{bounds:[299,134,443,149],properties:{items:['Select One']}}\
};");

dlg.slider0.onChanging = function (){
app.activeDocument.activeLayer.opacity = dlg.slider0.value;
}
dlg.show();
this will change the opacity of the active layer, you can create two sliders and make them control the opacity of the required layers by pointing to these layers by index instead of app.activeDocument.activeLayer.opacity
good luck


Return to “Help Me”

Who is online

Users browsing this forum: No registered users and 1 guest