现在需要做一个任意角度的扇形,以后要用代码控制其如的从0度到360度的过渡;360度就是一个整圆了;
搞定了,安装了react-konva就可以很容易在react插入很多canvas绘制的图形了;
———————————————————————————————————————————————————
import React, { Component, PropTypes } from 'react'
import {Layer,Rect,Stage,Group,Circle,Arc} from 'react-konva';
class App extends React.Component {
constructor(...args) {
super(...args);
this.state = {
color: 'green'
};
this.handleClick = this.handleClick.bind(this);
}
handleClick() {
this.setState({
color: Konva.Util.getRandomColor()
});
}
render() {
return (
<Stage width={700} height={700}>
<Layer>
<Arc
x={100} y={100}
innerRadius={0}
outerRadius={100}
strokeWidth={1}
angle={360}
rotationDeg={-90}
fill={this.state.color}
stroke={'black'}
/>
</Layer>
</Stage>
);
}
}
export default App