Page 1 of 1

GUI with sliders that change opacity on multiple layers

Posted: Fri Mar 09, 2018 8:03 pm
by zachbright
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

Re: GUI with sliders that change opacity on multiple layers

Posted: Sat Mar 17, 2018 2:30 pm
by wasfiwasfi
yes, by using a script that runs at the end of the action.

Re: GUI with sliders that change opacity on multiple layers

Posted: Thu Mar 22, 2018 7:20 pm
by luis miguel
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.

Re: GUI with sliders that change opacity on multiple layers

Posted: Sat Apr 28, 2018 9:15 pm
by wasfiwasfi
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