所以,我有一张图片,我需要用PNG蒙版(黑色/透明图像)在另一张图片上覆盖它。如何使用KineticJS做到这一点?
对不起,我的英语不好
创建自定义Kinetic.Shape
:
var image = new Kinetic.Shape({
draggable: true,
x : 100,
y : 100,
sceneFunc : function(ctx) {
ctx.drawImage(mask, 0, 0);
ctx.setAttr('globalCompositeOperation', 'source-in');
ctx.drawImage(img, 0, 0);
},
hitFunc : function(ctx) {
ctx.rect(0,0,img.width, img.height);
ctx.fillStrokeShape(this);
}
});
本文收集自互联网,转载请注明来源。
如有侵权,请联系[email protected] 删除。
我来说两句