-
1. Re: Creating slider to control current layer opacity in HTML?
SlowMotion Jun 24, 2014 12:08 PM (in response to IntaglioGraphics)You're trying to pass values from HTML to JSX. Davide did a good write up on this a while back: http://www.davidebarranca.com/2014/01/html-panels-tips-4-passing-objects-from-html-to-jsx/
Basically, you need to use CSInterface.evalScript to call your function.
-
2. Re: Creating slider to control current layer opacity in HTML?
IntaglioGraphics Jun 24, 2014 12:24 PM (in response to SlowMotion)Yes I want to do this but can you please tell me how to make a slider as I am a noob program basically a designer so it's hard for to understand all the loops etc.
-
3. Re: Creating slider to control current layer opacity in HTML?
SlowMotion Jun 24, 2014 12:29 PM (in response to IntaglioGraphics)Time to learn then! What you are looking for is the range input in HTML. Some examples: http://demosthenes.info/blog/757/Playing-With-The-HTML5-range-Slider-Input
-
4. Re: Creating slider to control current layer opacity in HTML?
IntaglioGraphics Jun 24, 2014 12:55 PM (in response to SlowMotion)I tired to add that code but still its not working slider is showing up but function is not runnin.
HTML
<input type=range min=0 max=100 value=50 id=fader step=1 onchange="outputUpdate(value)">
JSX
$._ext_outputUpdate={
run : function (vol) {
app.activeDocument.activeLayer.opacity.value = vol;
}
};
-
5. Re: Re: Creating slider to control current layer opacity in HTML?
DBarranca Jun 25, 2014 1:34 PM (in response to IntaglioGraphics)Hi IntaglioGraphics,
have you set up a JS file which calls something like:
var csInterface = new CSInterface(); function outputUpdate(value) { csInterface.evalScript("setLayerOpacity('" + value + "')"); }and in the JSX:
function setLayerOpacity(layerOpacity) { app.activeDocument.activeLayer.opacity = layerOpacity; }I've verified that onChange works - in fact is more a onChanging than onChange (it looks like Google Chromium is wrong interpreting the specs). If you want an actual onChange - that is, the callback fired when the user stops dragging the thumb and not constantly, use onMouseUp.
Regards,
Davide Barranca
---
www.davidebarranca.com
www.cs-extensions.com
-
6. Re: Creating slider to control current layer opacity in HTML?
IntaglioGraphics Jun 26, 2014 4:58 AM (in response to DBarranca)Hi thanks alot for replying. Unfortunately it's still not working.
js/main.js
var csInterface = new CSInterface();
function outputUpdate(value) {
csInterface.evalScript("setLayerOpacity('" + value + "')");
}
jsx/Photoshop.jsx
run : function setLayerOpacity(layerOpacity) {
app.activeDocument.activeLayer.opacity = setLayerOpacity;
}
index.html
<!doctype html>
<html>
<head>
<meta charset="utf-8">
<script src="./ext.js"></script>
<script src="./lib/CSInterface-4.0.0.js"></script>
<link id="ppstyle" rel="stylesheet" type="text/css" href="./style.css">
<title>Test</title>
</head>
<body onLoad="onLoaded()">
<div id="content">
<input type="range" min="0" max="100" value="0" step="1" id="opacity" name="opacity" onChange="setLayerOpacity(this.value)"/>
</div>
</body>
<script src=’js/main.js’></script>
</html>
Slider is displaying in photoshop also moving but doing nothing.

