ตัวอย่าง แทคที่ใช้
ตัวอย่าง : วาดรูปทรงหลายเหลี่ยม
var stage = new Kinetic.Stage({
container: 'container',
width: 578,
height: 200
});
var layer = new Kinetic.Layer();
// ลักษณะการกำหนดเส้นจำใส่ตัวเลขเป็นคู่ๆ point[x,y,x,y,.....] อ้างอิงตำแหน่งบน canvas
var poly = new Kinetic.Polygon({
points: [73, 192, 73, 160, 340, 23, 500, 109, 499, 139, 342, 93],
fill: 'blue', // ใส่สีพื้น
stroke: 'black', // กำหนดสีเส้น
strokeWidth: 5 // กำหนดขนาดเส้น
});
// add the shape to the layer
layer.add(poly);
// add the layer to the stage
stage.add(layer);
ผลลัพธ์ที่ได้คือ

0 comments:
Post a Comment