2014-09-24 90 views

回答

1

創建自定義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); 
    } 
    }); 

http://jsbin.com/bagix/1/edit

+0

真棒,謝謝! – 2014-09-29 06:34:14