我正在开发一个网站,其中用户可以通过设置搜索词执行图像搜索。然后,基于用户可以选择或修改的一些参数来显示图像,如位置、大小等。我想要提供的一种可能性是将混合模式应用于图像。经过一些研究和测试,我选择了camanJS library来应用这些混合效果。该库的工作方式是,混合模式只能应用于层,您可以将一个层堆叠在另一个层中,例如:
Caman('#test', imgSource, function () {
this.newLayer(function () {
this.setBlendingMode('multiply');
this.overlayImage(someOtherImgSource);
this.newLayer(function () {
this.setBlendingMode('softLight');
this.overlayImage(evenOtherImgSource);
//and so on...
});
});
this.render();
});以便在单个画布内的各层中应用混合模式。我的问题是:如果我有一个图像数组,我如何堆叠这些函数,一个在另一个中,与我的数组中的图像数量一样多?
谢谢!
发布于 2013-06-05 16:46:12
var images="#image1","#image2","#image3";
该数组包含每个图像的div id。
Caman('#test', imgSource, function () {
this.newLayer(function () {
this.setBlendingMode('multiply');
this.overlayImage(images[0]);
this.newLayer(function () {
this.setBlendingMode('softLight');
this.overlayImage(images[1]);
//and so on...
});
});
this.render();
});https://stackoverflow.com/questions/16928161
复制相似问题