0
所以我想從按鈕點擊在我定義的舞臺內畫一個圓。我在網頁上沒有收到任何錯誤,點擊後沒有錯誤。我使用了調試消息,代碼正在執行,但我看不到任何圖像顯示或任何錯誤指示。我可以幫忙嗎?謝謝。動力學圓不會畫按鈕點擊
這裏是我的javascript代碼(這是我的第一篇文章,我希望我這樣做是正確的)
var height = $(".game").height();
var width = $(".game").width();
$(function() {
$('#head').on('click', function() {
shapeMaker.createHead();
});
});
var shapeMaker = {
stage: null,
head: null,
createHead: function() {
var stage = new Kinetic.Stage({
container: 'game',
width: $('.game').width(),
height: $('.game').height()
});
var head = new Kinetic.Layer();
var circle = new Kinetic.Circle({
x: 0,
y: 0,
radius: stage.getHeight()/3,
fill: '#FFDF5E',
stroke: 'black',
strokeWidth: 3
});
// add the shape to the layer
head.add(circle);
// add the layer to the stage
head.draw();
stage.add(head);
}
}