Want to create a simple image brightness control slider

后端 未结 4 579
轻奢々
轻奢々 2021-01-06 09:54

I wanted to implement a slider control that changes the brightness of the image, much like the one shown at this link :

http://camanjs.com/examples/

I am fa

4条回答
  •  孤城傲影
    2021-01-06 10:06

    //this is the event handler called when the slider value changes
    function brightnessControl(e, ui) {
      //mainImage is the id of the canvas that holds the image
      Caman("#mainImage", function() {
        this.style.filter='brightness(ui.value)';//like this: filter: brightness(0.4)
        //this.brightness(ui.value);
       // this.render(); i don/t know this is useful? you judge it by yourself
      });
    }
    

    the brightness is from 0 to 1.

提交回复
热议问题