我正在尝试使用 Kinetic 构建我的设计师在 Photoshop 中设计的东西(但愿意使用其他一些库)。这是我的设计师设计的:
似乎没有火箭科学,只是一些弧线和圆圈。但圆弧的末端不是与圆成一直线而是垂直的。我一直在尝试,但到目前为止没有运气。有人有想法吗?
我的代码:
var stage = new Kinetic.Stage({
container: 'container',
width: 578,
height: 400
});
var layer = new Kinetic.Layer();
var circle = new Kinetic.Circle({
x: stage.getWidth() / 2,
y: stage.getHeight() / 2,
radius: 169,
fill: '#C0210F'
// stroke: 'black',
// strokeWidth: 4
});
var wedge = new Kinetic.Wedge({
x: stage.getWidth() / 2,
y: stage.getHeight() / 2,
radius: 170,
angleDeg: 200,
fill: '#EFC8C3',
//stroke: 'black',
//strokeWidth: 4,
rotationDeg: -90
});
var circle2 = new Kinetic.Circle({
x: stage.getWidth() / 2,
y: stage.getHeight() / 2,
radius: 120,
fill: '#c02428'
//stroke: 'black',
//strokeWidth: 4
});
var wedge2 = new Kinetic.Wedge({
x: stage.getWidth() / 2,
y: stage.getHeight() / 2,
radius: 120,
angleDeg: 220,
fill: '#611B61',
//stroke: 'black',
//strokeWidth: 4,
rotationDeg: -90
});
var circle3 = new Kinetic.Circle({
x: stage.getWidth() / 2,
y: stage.getHeight() / 2,
radius: 110,
fill: 'red'
//stroke: 'black',
//strokeWidth: 4
});
// add the shape to the layer
layer.add(circle);
layer.add(wedge);
layer.add(circle2);
layer.add(wedge2);
layer.add(circle3);
// add the layer to the stage
stage.add(layer);
小提琴:http: //jsfiddle.net/ExwER/
亲切的问候,
彼得