レイヤーを追加し、塗りつぶしの色に設定し、ブレンドモードを設定するためにうまく機能している比較的単純なCamanJSがあります。
function changeColor(layer, hexCode) {
Caman(layer, function() {
this.greyscale();
this.contrast(-10);
this.newLayer(function () {
this.setBlendingMode("overlay");
this.fillColor(hexCode);
});
this.render();
});
};
changeColor('#paint','#ff0000');
function changeFilter(layer, hexCode) {
Caman(layer).revert(false);
changeColor(layer,hexCode);
};
ただし、画像を元に戻して最初からやり直すことなく、そのレイヤーの設定 (fillColor) の 1 つだけを変更する方法がわかりません。これが最善の方法ですか?または、fillColor 自体を更新することはできますか?