2014-09-25 64 views
0

我正在尝试使用kineticJs的拼图游戏。我得到了不规则的形状部分,但源图像不显示或填充它。我坚持这部分。拼图源图像不显示

fill:{ 
    image:imageObj, 
    x:pieceWidth, 
    y:pieceHeight, 
}, 
stroke: "#000000", 
strokeWidth: 4, 
lineCap: "round", 
draggable: true 
+0

你需要表现出更多的代码,因为我们不能告诉你在做什么......而'填写:{图片:imageObj,X:pieceWidth,Y:pieceHeight,},'是无效KineticJS句法。 : - / – markE 2014-09-27 04:20:50

回答

0

看起来你需要使用fillPatternImage而不是fill

var patternPentagon = new Kinetic.RegularPolygon({ 
     x: 220, 
     y: stage.height()/2, 
     sides: 5, 
     radius: 70, 
     fillPatternImage: images.darthVader, 
     fillPatternOffset: {x:-220, y:70}, 
     stroke: 'black', 
     strokeWidth: 4, 
     draggable: true 
});