如何并排放置组的两个实例?
var stage = new Kinetic.Stage({
container: 'canvas',
height: 125,
width: 250
});
var layerLeft = new Kinetic.Layer({
x: 62.5,
y: 62.5,
height: 125,
width: 125
});
var layerRight = new Kinetic.Layer({
x: 187.5,
y: 62.5,
height: 125,
width: 125
});
var group = new Kinetic.Group({
offset: [62.5, 62.5]
});
var circle = new Kinetic.Circle({
x: (stage.getWidth() / 4),
y: stage.getHeight() / 2,
width: 124,
height: 124,
stroke: 'grey',
strokeWidth: 1
});
var topPath = new Kinetic.Path({
data: 'M50.5,10.5 L50.5,10.5 75,10.5 L75,10.5 68.55,34.5 L68.55,34.5 56.45,34.5 L56.45,34.5 50.5,10.5 Z',
stroke: 'grey',
strokeWidth: 1
});
var leftPath = new Kinetic.Path({
data: 'M25,100 L25,100 42,81 L42,81 35.5,70.5 L35.5,70.5 11,77 L11,77 25,100 Z',
stroke: 'grey',
strokeWidth: 1
});
var rightPath = new Kinetic.Path({
data: 'M100,100 L100,100 83,81 L83,81 89.5,70.5 L89.5,70.5 113.5,76.75 L113.5,76.75 100,100 Z',
stroke: 'grey',
strokeWidth: 1
});
group.add(circle);
group.add(topPath);
group.add(leftPath);
group.add(rightPath);
layerRight.add(group);
//layerLeft.add(group);
stage.add(layerLeft);
stage.add(layerRight);
我尝试过的事情:
• 将路径/圆圈添加到一层上的两个单独的组。
• 将一组添加到两层。
这是关闭问题吗?我已经阅读了所有相关内容,但我不太明白如何解决它。