mirror of
https://github.com/konvajs/konva.git
synced 2025-05-06 14:47:52 +08:00
42 lines
804 B
JavaScript
42 lines
804 B
JavaScript
![]() |
Test.Modules.POLYGON - {
|
||
|
'add polygon': function(containerId) {
|
||
|
var stage = new Kinetic.Stage({
|
||
|
container: containerId,
|
||
|
width: 578,
|
||
|
height: 200
|
||
|
});
|
||
|
var layer = new Kinetic.Layer();
|
||
|
|
||
|
var points = [{
|
||
|
x: 73,
|
||
|
y: 192
|
||
|
}, {
|
||
|
x: 73,
|
||
|
y: 160
|
||
|
}, {
|
||
|
x: 340,
|
||
|
y: 23
|
||
|
}, {
|
||
|
x: 500,
|
||
|
y: 109
|
||
|
}, {
|
||
|
x: 499,
|
||
|
y: 139
|
||
|
}, {
|
||
|
x: 342,
|
||
|
y: 93
|
||
|
}];
|
||
|
|
||
|
var poly = new Kinetic.Polygon({
|
||
|
points: points,
|
||
|
fill: 'green',
|
||
|
stroke: 'blue',
|
||
|
strokeWidth: 5
|
||
|
});
|
||
|
|
||
|
layer.add(poly);
|
||
|
stage.add(layer);
|
||
|
|
||
|
}
|
||
|
};
|