2012-11-14 13:37:28 +08:00
|
|
|
Test.Modules.STAR = {
|
|
|
|
'add five point star': function(containerId) {
|
|
|
|
var stage = new Kinetic.Stage({
|
|
|
|
container: containerId,
|
|
|
|
width: 578,
|
|
|
|
height: 200
|
|
|
|
});
|
|
|
|
var layer = new Kinetic.Layer();
|
|
|
|
|
|
|
|
var star = new Kinetic.Star({
|
|
|
|
x: 200,
|
|
|
|
y: 100,
|
|
|
|
numPoints: 5,
|
|
|
|
innerRadius: 40,
|
|
|
|
outerRadius: 70,
|
|
|
|
fill: 'green',
|
|
|
|
stroke: 'blue',
|
|
|
|
strokeWidth: 5,
|
|
|
|
name: 'foobar',
|
|
|
|
offset: {
|
|
|
|
x: 0,
|
|
|
|
y: -70
|
|
|
|
},
|
|
|
|
scale: {
|
|
|
|
x: 0.5,
|
|
|
|
y: 0.5
|
|
|
|
}
|
|
|
|
});
|
|
|
|
|
|
|
|
layer.add(star);
|
|
|
|
stage.add(layer);
|
|
|
|
},
|
2013-01-10 15:45:30 +08:00
|
|
|
'add five point star with line join and shadow': function(containerId) {
|
2012-11-14 13:37:28 +08:00
|
|
|
var stage = new Kinetic.Stage({
|
|
|
|
container: containerId,
|
|
|
|
width: 578,
|
|
|
|
height: 200
|
|
|
|
});
|
|
|
|
var layer = new Kinetic.Layer();
|
|
|
|
|
|
|
|
var rect = new Kinetic.Rect({
|
|
|
|
x: 250,
|
|
|
|
y: 75,
|
|
|
|
width: 100,
|
|
|
|
height: 100,
|
|
|
|
fill: 'red'
|
|
|
|
});
|
|
|
|
|
|
|
|
var star = new Kinetic.Star({
|
|
|
|
x: 200,
|
|
|
|
y: 100,
|
|
|
|
numPoints: 5,
|
|
|
|
innerRadius: 40,
|
|
|
|
outerRadius: 70,
|
|
|
|
fill: 'green',
|
|
|
|
stroke: 'blue',
|
|
|
|
strokeWidth: 5,
|
|
|
|
lineJoin: "round",
|
2013-01-01 02:46:23 +08:00
|
|
|
shadowColor: 'black',
|
|
|
|
shadowBlur: 10,
|
|
|
|
shadowOffset: [20, 20],
|
|
|
|
shadowOpacity: 0.5,
|
2012-11-14 13:37:28 +08:00
|
|
|
draggable: true
|
|
|
|
});
|
|
|
|
|
|
|
|
layer.add(rect);
|
|
|
|
layer.add(star);
|
|
|
|
|
|
|
|
stage.add(layer);
|
|
|
|
|
|
|
|
test(star.getLineJoin() === 'round', 'lineJoin property should be round');
|
|
|
|
star.setLineJoin('bevel');
|
|
|
|
test(star.getLineJoin() === 'bevel', 'lineJoin property should be bevel');
|
|
|
|
|
|
|
|
star.setLineJoin('round');
|
|
|
|
}
|
|
|
|
};
|