ตัวอย่าง HTML
ตัวอย่าง JS
var stage = new Konva.Stage({ container: 'container', width : $('#container').width(), height : $('#container').height() }); var layer = new Konva.Layer(); stage.add(layer); var GRID_SIZE = 20, width = stage.getWidth(), height = stage.getHeight(); // horizontal line for (var i = 0; i < width + 1; i++) { var I = i * GRID_SIZE; var l = new Konva.Line({ strokeWidth : 1, stroke: "#ddd", points: [I, 0, I, height] }); layer.add(l); } // vertical line for (var j = 0; j < height + 1; j++) { var J = j * GRID_SIZE; var l2 = new Konva.Line({ strokeWidth : 1, stroke: "#ddd", points: [0, J, width, J] }); layer.add(l2); } layer.draw();
ตัวอย่าง CSS
body { padding:20px; } #container { border:solid 1px #ccc; margin-top: 10px; width:800px; height:400px; }
ผลลัพธ์ที่ได้คือ
0 comments:
Post a Comment