我想繪製一個六邊形並使用html5顯示一個圖像。 我已經嘗試過,但我沒有得到圖像作爲結果。 我只想爲此使用kineticjs。用html5和kineticjs顯示六角形內的圖像
下面是代碼:
function hexagon(){
var stage = new Kinetic.Stage({
container: "container"
});
var layer = new Kinetic.Layer();
var hexagon = new Kinetic.RegularPolygon({
x: 100,
y: 100,
sides: 6,
radius: 100,
fill: {image: "css/images/logo.png"},
stroke: "royalblue",
strokeWidth: 2
});
// add the shape to the layer
layer.add(hexagon);
// add the layer to the stage
stage.add(layer);
}
它不工作。我也試圖把kineticimage的對象。但它仍然不起作用。 – Hiral
調試控制檯是否告訴你任何有用的信息? –
不,我只是得到一個黑色填充六邊形而不是六邊形內的圖像。該怎麼辦? – Hiral